Merge branch 'test6.9.13' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.13
Showing
9 changed files
with
93 additions
and
52 deletions
@@ -4,7 +4,8 @@ import com.alibaba.fastjson.JSONObject; | @@ -4,7 +4,8 @@ import com.alibaba.fastjson.JSONObject; | ||
4 | import com.yoho.core.rabbitmq.YhConsumer; | 4 | import com.yoho.core.rabbitmq.YhConsumer; |
5 | import com.yoho.error.ServiceError; | 5 | import com.yoho.error.ServiceError; |
6 | import com.yoho.error.exception.ServiceException; | 6 | import com.yoho.error.exception.ServiceException; |
7 | -import com.yoho.message.sdk.service.ufo.UFOBidMessageService; | 7 | +import com.yoho.message.sdk.common.constants.UFOMessageScene; |
8 | +import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; | ||
8 | import com.yohobuy.ufo.model.order.common.OrderStatus; | 9 | import com.yohobuy.ufo.model.order.common.OrderStatus; |
9 | import com.yohoufo.dal.order.BuyerOrderGoodsMapper; | 10 | import com.yohoufo.dal.order.BuyerOrderGoodsMapper; |
10 | import com.yohoufo.dal.order.BuyerOrderMapper; | 11 | import com.yohoufo.dal.order.BuyerOrderMapper; |
@@ -16,15 +17,12 @@ import com.yohoufo.dal.product.ProductMapper; | @@ -16,15 +17,12 @@ import com.yohoufo.dal.product.ProductMapper; | ||
16 | import com.yohoufo.dal.product.model.Product; | 17 | import com.yohoufo.dal.product.model.Product; |
17 | import com.yohoufo.order.event.BuyerOrderUnpaidDelayReminderEvent; | 18 | import com.yohoufo.order.event.BuyerOrderUnpaidDelayReminderEvent; |
18 | import com.yohoufo.order.mq.TopicConstants; | 19 | import com.yohoufo.order.mq.TopicConstants; |
20 | +import com.yohoufo.order.service.proxy.BuyerNoticeFacade; | ||
19 | import com.yohoufo.order.utils.LoggerUtils; | 21 | import com.yohoufo.order.utils.LoggerUtils; |
20 | import org.slf4j.Logger; | 22 | 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.Component; | 24 | import org.springframework.stereotype.Component; |
23 | - | ||
24 | -import java.util.HashMap; | ||
25 | -import java.util.Map; | ||
26 | - | ||
27 | -import static com.yoho.message.sdk.service.ufo.UFOBidMessageService.Scene.*; | 25 | +import java.util.LinkedHashMap; |
28 | 26 | ||
29 | @Component | 27 | @Component |
30 | public class BuyerOrderUnpaidReminderDelayMsgConsumer implements YhConsumer { | 28 | public class BuyerOrderUnpaidReminderDelayMsgConsumer implements YhConsumer { |
@@ -44,7 +42,7 @@ public class BuyerOrderUnpaidReminderDelayMsgConsumer implements YhConsumer { | @@ -44,7 +42,7 @@ public class BuyerOrderUnpaidReminderDelayMsgConsumer implements YhConsumer { | ||
44 | protected ProductMapper productMapper; | 42 | protected ProductMapper productMapper; |
45 | 43 | ||
46 | @Autowired | 44 | @Autowired |
47 | - protected UFOBidMessageService ufoBidMessageService; | 45 | + protected BuyerNoticeFacade buyerNoticeFacade; |
48 | 46 | ||
49 | 47 | ||
50 | public String getTopic() { | 48 | public String getTopic() { |
@@ -89,13 +87,17 @@ public class BuyerOrderUnpaidReminderDelayMsgConsumer implements YhConsumer { | @@ -89,13 +87,17 @@ public class BuyerOrderUnpaidReminderDelayMsgConsumer implements YhConsumer { | ||
89 | Product product = findProduct(sellerOrderGoods); | 87 | Product product = findProduct(sellerOrderGoods); |
90 | String productCode = product.getProductCode(); | 88 | String productCode = product.getProductCode(); |
91 | 89 | ||
92 | - Map<String, Object> parameters = new HashMap<>(); | 90 | + LinkedHashMap<String, Object> parameters = new LinkedHashMap<>(); |
93 | parameters.put("productName", prdName); | 91 | parameters.put("productName", prdName); |
94 | parameters.put("sizeName", sizeName); | 92 | parameters.put("sizeName", sizeName); |
95 | parameters.put("productCode", productCode); | 93 | parameters.put("productCode", productCode); |
96 | parameters.put("remainingHour", remainingHour); | 94 | parameters.put("remainingHour", remainingHour); |
97 | parameters.put("orderCode", buyerOrder.getOrderCode()); | 95 | parameters.put("orderCode", buyerOrder.getOrderCode()); |
98 | - ufoBidMessageService.sendMessage(String.valueOf(buyerOrder.getUid()), UFO_BUYER_BID_PAY_REMINDER, parameters); | 96 | + |
97 | + buyerNoticeFacade.messageNotice(buyerOrder.getUid(), InboxBusinessTypeEnum.BUYER_BID_PAY_REMINDER, | ||
98 | + InboxBusinessTypeEnum.SMS_BUYER_BID_PAY_REMINDER, | ||
99 | + UFOMessageScene.UFO_BUYER_BID_PAY_REMINDER, | ||
100 | + parameters); | ||
99 | } | 101 | } |
100 | 102 | ||
101 | protected SellerOrderGoods findSellerOrderGoods(BuyerOrder buyerOrder) { | 103 | protected SellerOrderGoods findSellerOrderGoods(BuyerOrder buyerOrder) { |
@@ -2,7 +2,6 @@ package com.yohoufo.order.service; | @@ -2,7 +2,6 @@ package com.yohoufo.order.service; | ||
2 | 2 | ||
3 | import com.yoho.error.ServiceError; | 3 | import com.yoho.error.ServiceError; |
4 | import com.yoho.error.exception.ServiceException; | 4 | import com.yoho.error.exception.ServiceException; |
5 | -import com.yoho.message.sdk.service.ufo.UFOBidMessageService; | ||
6 | import com.yohobuy.ufo.model.order.common.OrderStatus; | 5 | import com.yohobuy.ufo.model.order.common.OrderStatus; |
7 | import com.yohobuy.ufo.model.order.common.TabType; | 6 | import com.yohobuy.ufo.model.order.common.TabType; |
8 | import com.yohoufo.common.alarm.EventBusPublisher; | 7 | import com.yohoufo.common.alarm.EventBusPublisher; |
@@ -23,6 +22,7 @@ import com.yohoufo.order.model.bo.BidOrderMetaBo; | @@ -23,6 +22,7 @@ import com.yohoufo.order.model.bo.BidOrderMetaBo; | ||
23 | import com.yohoufo.order.service.cache.CacheCleaner; | 22 | import com.yohoufo.order.service.cache.CacheCleaner; |
24 | import com.yohoufo.order.service.listener.OrderChangeListenerContainer; | 23 | import com.yohoufo.order.service.listener.OrderChangeListenerContainer; |
25 | import com.yohoufo.order.service.proxy.BidProductProxyService; | 24 | import com.yohoufo.order.service.proxy.BidProductProxyService; |
25 | +import com.yohoufo.order.service.proxy.BuyerNoticeFacade; | ||
26 | import com.yohoufo.order.service.proxy.OrderStatusFlowService; | 26 | import com.yohoufo.order.service.proxy.OrderStatusFlowService; |
27 | import com.yohoufo.order.service.support.BuyerOrderMetaMapperSupport; | 27 | import com.yohoufo.order.service.support.BuyerOrderMetaMapperSupport; |
28 | import com.yohoufo.order.utils.LoggerUtils; | 28 | import com.yohoufo.order.utils.LoggerUtils; |
@@ -91,7 +91,7 @@ public abstract class AbstractBuyerOrderStateChanger<T extends RequestedStatusCh | @@ -91,7 +91,7 @@ public abstract class AbstractBuyerOrderStateChanger<T extends RequestedStatusCh | ||
91 | protected ProductMapper productMapper; | 91 | protected ProductMapper productMapper; |
92 | 92 | ||
93 | @Autowired | 93 | @Autowired |
94 | - protected UFOBidMessageService ufoBidMessageService; | 94 | + protected BuyerNoticeFacade buyerNoticeFacade; |
95 | 95 | ||
96 | /** | 96 | /** |
97 | * 变更 | 97 | * 变更 |
1 | package com.yohoufo.order.service.impl.statechange; | 1 | package com.yohoufo.order.service.impl.statechange; |
2 | 2 | ||
3 | import com.google.common.collect.Lists; | 3 | import com.google.common.collect.Lists; |
4 | -import com.yoho.message.sdk.service.ufo.UFOBidMessageService; | 4 | +import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; |
5 | import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo; | 5 | import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo; |
6 | import com.yohobuy.ufo.model.order.common.OrderStatus; | 6 | import com.yohobuy.ufo.model.order.common.OrderStatus; |
7 | import com.yohobuy.ufo.model.order.constants.OrderConstant; | 7 | import com.yohobuy.ufo.model.order.constants.OrderConstant; |
@@ -16,10 +16,9 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -16,10 +16,9 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
16 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
17 | 17 | ||
18 | import java.util.Collection; | 18 | import java.util.Collection; |
19 | -import java.util.HashMap; | ||
20 | -import java.util.Map; | 19 | +import java.util.LinkedHashMap; |
21 | 20 | ||
22 | -import static com.yoho.message.sdk.service.ufo.UFOBidMessageService.Scene.*; | 21 | +import static com.yoho.message.sdk.common.constants.UFOMessageScene.*; |
23 | import static com.yohobuy.ufo.model.order.common.OrderStatus.*; | 22 | import static com.yohobuy.ufo.model.order.common.OrderStatus.*; |
24 | import static com.yohoufo.order.common.RefundCase.SELLER_EARNEST_MONEY; | 23 | import static com.yohoufo.order.common.RefundCase.SELLER_EARNEST_MONEY; |
25 | 24 | ||
@@ -93,29 +92,26 @@ public class BuyerOrderBidingCancelChanger extends AbstractBuyerOrderStateChange | @@ -93,29 +92,26 @@ public class BuyerOrderBidingCancelChanger extends AbstractBuyerOrderStateChange | ||
93 | Product product = findProduct(sellerOrderGoods); | 92 | Product product = findProduct(sellerOrderGoods); |
94 | String productCode = product.getProductCode(); | 93 | String productCode = product.getProductCode(); |
95 | 94 | ||
96 | - Map<String, Object> parameters = new HashMap<>(); | 95 | + LinkedHashMap<String, Object> parameters = new LinkedHashMap<>(); |
97 | parameters.put("productName", prdName); | 96 | parameters.put("productName", prdName); |
98 | parameters.put("sizeName", sizeName); | 97 | parameters.put("sizeName", sizeName); |
99 | parameters.put("productCode", productCode); | 98 | parameters.put("productCode", productCode); |
100 | parameters.put("orderCode", buyerOrder.getOrderCode()); | 99 | parameters.put("orderCode", buyerOrder.getOrderCode()); |
101 | 100 | ||
102 | - UFOBidMessageService.Scene scene; | ||
103 | - | ||
104 | switch (targetStatus) { | 101 | switch (targetStatus) { |
105 | case BUYER_CLOSE_BID: | 102 | case BUYER_CLOSE_BID: |
106 | - scene = UFO_BUYER_CLOSE_BID; | 103 | + buyerNoticeFacade.messageNotice(buyerOrder.getUid(), InboxBusinessTypeEnum.BUYER_CLOSE_BID, null, null, parameters); |
107 | break; | 104 | break; |
108 | case SYSTEM_CLOSE_BID: | 105 | case SYSTEM_CLOSE_BID: |
109 | - scene = UFO_SYSTEM_CLOSE_BID; | 106 | + buyerNoticeFacade.messageNotice(buyerOrder.getUid(), InboxBusinessTypeEnum.SYSTEM_CLOSE_BID, InboxBusinessTypeEnum.SMS_SYSTEM_CLOSE_BID, UFO_SYSTEM_CLOSE_BID, parameters); |
110 | break; | 107 | break; |
111 | case PLATFORM_CLOSE_BID: | 108 | case PLATFORM_CLOSE_BID: |
112 | - scene = UFO_PLATFORM_CLOSE_BID; | 109 | + buyerNoticeFacade.messageNotice(buyerOrder.getUid(), InboxBusinessTypeEnum.PLATFORM_CLOSE_BID, InboxBusinessTypeEnum.SMS_PLATFORM_CLOSE_BID, UFO_PLATFORM_CLOSE_BID, parameters); |
113 | break; | 110 | break; |
114 | default: | 111 | default: |
115 | - scene = null; | ||
116 | break; | 112 | break; |
117 | } | 113 | } |
118 | - ufoBidMessageService.sendMessage(String.valueOf(buyerOrder.getUid()), scene, parameters); | 114 | + |
119 | } | 115 | } |
120 | 116 | ||
121 | } | 117 | } |
1 | package com.yohoufo.order.service.impl.statechange; | 1 | package com.yohoufo.order.service.impl.statechange; |
2 | 2 | ||
3 | import com.google.common.collect.Lists; | 3 | import com.google.common.collect.Lists; |
4 | +import com.yoho.message.sdk.common.constants.UFOMessageScene; | ||
5 | +import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; | ||
4 | import com.yohobuy.ufo.model.order.common.OrderStatus; | 6 | import com.yohobuy.ufo.model.order.common.OrderStatus; |
5 | import com.yohoufo.common.alarm.EventBusPublisher; | 7 | import com.yohoufo.common.alarm.EventBusPublisher; |
6 | import com.yohoufo.common.utils.DateUtil; | 8 | import com.yohoufo.common.utils.DateUtil; |
@@ -16,10 +18,7 @@ import com.yohoufo.order.service.AbstractBuyerOrderStateChanger; | @@ -16,10 +18,7 @@ import com.yohoufo.order.service.AbstractBuyerOrderStateChanger; | ||
16 | import org.springframework.stereotype.Service; | 18 | import org.springframework.stereotype.Service; |
17 | 19 | ||
18 | import java.util.Collection; | 20 | import java.util.Collection; |
19 | -import java.util.HashMap; | ||
20 | -import java.util.Map; | ||
21 | - | ||
22 | -import static com.yoho.message.sdk.service.ufo.UFOBidMessageService.Scene.*; | 21 | +import java.util.LinkedHashMap; |
23 | import static com.yohobuy.ufo.model.order.common.OrderStatus.*; | 22 | import static com.yohobuy.ufo.model.order.common.OrderStatus.*; |
24 | 23 | ||
25 | @Service | 24 | @Service |
@@ -89,13 +88,15 @@ public class BuyerOrderBidingToWaitingPayChanger extends AbstractBuyerOrderState | @@ -89,13 +88,15 @@ public class BuyerOrderBidingToWaitingPayChanger extends AbstractBuyerOrderState | ||
89 | String productCode = product.getProductCode(); | 88 | String productCode = product.getProductCode(); |
90 | 89 | ||
91 | 90 | ||
92 | - Map<String, Object> parameters = new HashMap<>(); | 91 | + LinkedHashMap<String, Object> parameters = new LinkedHashMap<>(); |
93 | parameters.put("productName", prdName); | 92 | parameters.put("productName", prdName); |
94 | parameters.put("sizeName", sizeName); | 93 | parameters.put("sizeName", sizeName); |
95 | parameters.put("productCode", productCode); | 94 | parameters.put("productCode", productCode); |
96 | parameters.put("goodsPrice", sellerOrderGoods.getGoodsPrice().toPlainString()); | 95 | parameters.put("goodsPrice", sellerOrderGoods.getGoodsPrice().toPlainString()); |
97 | parameters.put("orderCode", buyerOrder.getOrderCode()); | 96 | parameters.put("orderCode", buyerOrder.getOrderCode()); |
98 | 97 | ||
99 | - ufoBidMessageService.sendMessage(String.valueOf(buyerOrder.getUid()), UFO_BID_SUCCESS, parameters); | 98 | + buyerNoticeFacade.messageNotice(buyerOrder.getUid(), InboxBusinessTypeEnum.BID_SUCCESS, |
99 | + InboxBusinessTypeEnum.SMS_BID_SUCCESS, | ||
100 | + UFOMessageScene.UFO_BID_SUCCESS,parameters); | ||
100 | } | 101 | } |
101 | } | 102 | } |
1 | package com.yohoufo.order.service.impl.statechange; | 1 | package com.yohoufo.order.service.impl.statechange; |
2 | 2 | ||
3 | import com.google.common.collect.Lists; | 3 | import com.google.common.collect.Lists; |
4 | +import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; | ||
4 | import com.yohobuy.ufo.model.order.common.OrderStatus; | 5 | import com.yohobuy.ufo.model.order.common.OrderStatus; |
5 | import com.yohobuy.ufo.model.order.constants.ChangePriceStatus; | 6 | import com.yohobuy.ufo.model.order.constants.ChangePriceStatus; |
6 | import com.yohoufo.common.alarm.EventBusPublisher; | 7 | import com.yohoufo.common.alarm.EventBusPublisher; |
@@ -19,11 +20,9 @@ import com.yohoufo.order.service.IBuyerOrderService; | @@ -19,11 +20,9 @@ import com.yohoufo.order.service.IBuyerOrderService; | ||
19 | import com.yohoufo.order.service.impl.BuyerChangePriceRecordService; | 20 | import com.yohoufo.order.service.impl.BuyerChangePriceRecordService; |
20 | import org.springframework.beans.factory.annotation.Autowired; | 21 | import org.springframework.beans.factory.annotation.Autowired; |
21 | import org.springframework.stereotype.Service; | 22 | import org.springframework.stereotype.Service; |
22 | -import static com.yoho.message.sdk.service.ufo.UFOBidMessageService.Scene.*; | ||
23 | 23 | ||
24 | import java.util.Collection; | 24 | import java.util.Collection; |
25 | -import java.util.HashMap; | ||
26 | -import java.util.Map; | 25 | +import java.util.LinkedHashMap; |
27 | 26 | ||
28 | /** | 27 | /** |
29 | * 支付定金完成 | 28 | * 支付定金完成 |
@@ -120,10 +119,10 @@ public class BuyerOrderPayDepositSuccessChanger extends AbstractBuyerOrderStateC | @@ -120,10 +119,10 @@ public class BuyerOrderPayDepositSuccessChanger extends AbstractBuyerOrderStateC | ||
120 | Product product = findProduct(sellerOrderGoods); | 119 | Product product = findProduct(sellerOrderGoods); |
121 | String productCode = product.getProductCode(); | 120 | String productCode = product.getProductCode(); |
122 | 121 | ||
123 | - Map<String, Object> parameters = new HashMap<>(); | 122 | + LinkedHashMap<String, Object> parameters = new LinkedHashMap<>(); |
124 | parameters.put("productName", prdName); | 123 | parameters.put("productName", prdName); |
125 | parameters.put("sizeName", sizeName); | 124 | parameters.put("sizeName", sizeName); |
126 | parameters.put("productCode", productCode); | 125 | parameters.put("productCode", productCode); |
127 | - ufoBidMessageService.sendMessage(String.valueOf(uid), UFO_BUYER_DEPOSIT_PAY_FINISHED, parameters); | 126 | + buyerNoticeFacade.messageNotice(uid, InboxBusinessTypeEnum.BUYER_DEPOSIT_PAY_FINISHED, null, null, parameters); |
128 | } | 127 | } |
129 | } | 128 | } |
@@ -3,7 +3,8 @@ package com.yohoufo.order.service.impl.statechange; | @@ -3,7 +3,8 @@ package com.yohoufo.order.service.impl.statechange; | ||
3 | import com.google.common.collect.Lists; | 3 | import com.google.common.collect.Lists; |
4 | import com.yoho.error.ServiceError; | 4 | import com.yoho.error.ServiceError; |
5 | import com.yoho.error.exception.ServiceException; | 5 | import com.yoho.error.exception.ServiceException; |
6 | -import com.yoho.message.sdk.service.ufo.UFOBidMessageService; | 6 | +import com.yoho.message.sdk.common.constants.UFOMessageScene; |
7 | +import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; | ||
7 | import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo; | 8 | import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo; |
8 | import com.yohobuy.ufo.model.order.common.OrderStatus; | 9 | import com.yohobuy.ufo.model.order.common.OrderStatus; |
9 | import com.yohobuy.ufo.model.order.common.Payment; | 10 | import com.yohobuy.ufo.model.order.common.Payment; |
@@ -36,13 +37,9 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -36,13 +37,9 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
36 | import org.springframework.stereotype.Service; | 37 | import org.springframework.stereotype.Service; |
37 | 38 | ||
38 | import java.math.BigDecimal; | 39 | import java.math.BigDecimal; |
39 | -import java.util.Arrays; | ||
40 | -import java.util.Collection; | ||
41 | -import java.util.HashMap; | ||
42 | -import java.util.Map; | 40 | +import java.util.*; |
43 | import java.util.concurrent.atomic.AtomicReference; | 41 | import java.util.concurrent.atomic.AtomicReference; |
44 | 42 | ||
45 | -import static com.yoho.message.sdk.service.ufo.UFOBidMessageService.Scene.*; | ||
46 | import static com.yohobuy.ufo.model.order.common.OrderStatus.*; | 43 | import static com.yohobuy.ufo.model.order.common.OrderStatus.*; |
47 | 44 | ||
48 | /** | 45 | /** |
@@ -175,6 +172,7 @@ public class BuyerOrderWaitingPayCancelChanger extends AbstractBuyerOrderStateCh | @@ -175,6 +172,7 @@ public class BuyerOrderWaitingPayCancelChanger extends AbstractBuyerOrderStateCh | ||
175 | 172 | ||
176 | /** | 173 | /** |
177 | * 退还卖家的保证金 | 174 | * 退还卖家的保证金 |
175 | + * | ||
178 | * @param skup | 176 | * @param skup |
179 | * @param buyerOrder | 177 | * @param buyerOrder |
180 | * @param targetOrderStatus | 178 | * @param targetOrderStatus |
@@ -262,26 +260,26 @@ public class BuyerOrderWaitingPayCancelChanger extends AbstractBuyerOrderStateCh | @@ -262,26 +260,26 @@ public class BuyerOrderWaitingPayCancelChanger extends AbstractBuyerOrderStateCh | ||
262 | Product product = findProduct(sellerOrderGoods); | 260 | Product product = findProduct(sellerOrderGoods); |
263 | String productCode = product.getProductCode(); | 261 | String productCode = product.getProductCode(); |
264 | 262 | ||
265 | - Map<String, Object> parameters = new HashMap<>(); | 263 | + LinkedHashMap<String, Object> parameters = new LinkedHashMap<>(); |
266 | parameters.put("productName", prdName); | 264 | parameters.put("productName", prdName); |
267 | parameters.put("sizeName", sizeName); | 265 | parameters.put("sizeName", sizeName); |
268 | parameters.put("productCode", productCode); | 266 | parameters.put("productCode", productCode); |
269 | parameters.put("goodsPrice", sellerOrderGoods.getGoodsPrice().toPlainString()); | 267 | parameters.put("goodsPrice", sellerOrderGoods.getGoodsPrice().toPlainString()); |
270 | parameters.put("orderCode", buyerOrder.getOrderCode()); | 268 | parameters.put("orderCode", buyerOrder.getOrderCode()); |
271 | 269 | ||
272 | - UFOBidMessageService.Scene scene; | ||
273 | - | ||
274 | switch (targetStatus) { | 270 | switch (targetStatus) { |
275 | case BUYER_BID_CANCEL_PAY: | 271 | case BUYER_BID_CANCEL_PAY: |
276 | - scene = UFO_BUYER_BID_CANCEL_PAY; | 272 | + buyerNoticeFacade.messageNotice(buyerOrder.getUid(), InboxBusinessTypeEnum.BUYER_BID_CANCEL_PAY, |
273 | + InboxBusinessTypeEnum.SMS_BUYER_BID_CANCEL_PAY, | ||
274 | + null, parameters); | ||
277 | break; | 275 | break; |
278 | case BUYER_BID_PAY_TIMEOUT: | 276 | case BUYER_BID_PAY_TIMEOUT: |
279 | - scene = UFO_BUYER_BID_PAY_TIMEOUT; | 277 | + buyerNoticeFacade.messageNotice(buyerOrder.getUid(), InboxBusinessTypeEnum.BUYER_BID_PAY_TIMEOUT, |
278 | + InboxBusinessTypeEnum.SMS_BUYER_BID_PAY_TIMEOUT, | ||
279 | + UFOMessageScene.UFO_BUYER_BID_PAY_TIMEOUT, parameters); | ||
280 | break; | 280 | break; |
281 | default: | 281 | default: |
282 | - scene = null; | ||
283 | break; | 282 | break; |
284 | } | 283 | } |
285 | - ufoBidMessageService.sendMessage(String.valueOf(buyerOrder.getUid()), scene, parameters); | ||
286 | } | 284 | } |
287 | } | 285 | } |
@@ -20,9 +20,7 @@ import org.slf4j.Logger; | @@ -20,9 +20,7 @@ import org.slf4j.Logger; | ||
20 | import org.slf4j.helpers.MessageFormatter; | 20 | import org.slf4j.helpers.MessageFormatter; |
21 | import org.springframework.beans.factory.annotation.Autowired; | 21 | import org.springframework.beans.factory.annotation.Autowired; |
22 | 22 | ||
23 | -import java.util.Arrays; | ||
24 | -import java.util.List; | ||
25 | -import java.util.Objects; | 23 | +import java.util.*; |
26 | import java.util.concurrent.ArrayBlockingQueue; | 24 | import java.util.concurrent.ArrayBlockingQueue; |
27 | import java.util.concurrent.ExecutorService; | 25 | import java.util.concurrent.ExecutorService; |
28 | import java.util.concurrent.ThreadPoolExecutor; | 26 | import java.util.concurrent.ThreadPoolExecutor; |
@@ -118,6 +116,13 @@ public class BaseNoticeFacade { | @@ -118,6 +116,13 @@ public class BaseNoticeFacade { | ||
118 | return this; | 116 | return this; |
119 | } | 117 | } |
120 | 118 | ||
119 | + public Notice withSmsIf(boolean condition, Supplier<String> smsContentSupplier) { | ||
120 | + if (condition) { | ||
121 | + this.smsContentSupplier = smsContentSupplier; | ||
122 | + } | ||
123 | + return this; | ||
124 | + } | ||
125 | + | ||
121 | public Notice withPush(Supplier<SendMessageRspBo> pushSupplier) { | 126 | public Notice withPush(Supplier<SendMessageRspBo> pushSupplier) { |
122 | this.pushSupplier = pushSupplier; | 127 | this.pushSupplier = pushSupplier; |
123 | return this; | 128 | return this; |
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.UFOBidMessageService; | ||
4 | import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; | 6 | import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; |
5 | import com.yohobuy.ufo.model.order.common.TabType; | 7 | import com.yohobuy.ufo.model.order.common.TabType; |
6 | import com.yohoufo.dal.order.model.BuyerOrder; | 8 | import com.yohoufo.dal.order.model.BuyerOrder; |
@@ -13,6 +15,7 @@ import org.slf4j.Logger; | @@ -13,6 +15,7 @@ import org.slf4j.Logger; | ||
13 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
14 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
15 | 17 | ||
18 | +import java.util.LinkedHashMap; | ||
16 | import java.util.Optional; | 19 | import java.util.Optional; |
17 | import java.util.function.Function; | 20 | import java.util.function.Function; |
18 | import java.util.function.Supplier; | 21 | import java.util.function.Supplier; |
@@ -27,11 +30,13 @@ public class BuyerNoticeFacade extends BaseNoticeFacade { | @@ -27,11 +30,13 @@ public class BuyerNoticeFacade extends BaseNoticeFacade { | ||
27 | @Autowired | 30 | @Autowired |
28 | private ProductMapper productMapper; | 31 | private ProductMapper productMapper; |
29 | 32 | ||
33 | + @Autowired | ||
34 | + private UFOBidMessageService ufoBidMessageService; | ||
35 | + | ||
30 | @Override | 36 | @Override |
31 | public Logger getLogger() { | 37 | public Logger getLogger() { |
32 | return log; | 38 | return log; |
33 | } | 39 | } |
34 | - | ||
35 | /** | 40 | /** |
36 | * 买家订单未付款 | 41 | * 买家订单未付款 |
37 | * | 42 | * |
@@ -456,4 +461,24 @@ public class BuyerNoticeFacade extends BaseNoticeFacade { | @@ -456,4 +461,24 @@ public class BuyerNoticeFacade extends BaseNoticeFacade { | ||
456 | // } | 461 | // } |
457 | // } | 462 | // } |
458 | 463 | ||
464 | + | ||
465 | + /** | ||
466 | + * | ||
467 | + * @param buyerUid | ||
468 | + * @param inbox | ||
469 | + * @param sms | ||
470 | + * @param push | ||
471 | + * @param parameters 保持顺序 | ||
472 | + */ | ||
473 | + public void messageNotice(int buyerUid, InboxBusinessTypeEnum inbox, InboxBusinessTypeEnum sms, UFOMessageScene push, LinkedHashMap<String, Object> parameters) { | ||
474 | + log.info("[{}] Buyer Message Notice,inbox:{},sms:{},push:{}", buyerUid, inbox, sms, push); | ||
475 | + Object[] params = parameters.values().toArray(new Object[0]); | ||
476 | + newNotice(buyerUid) | ||
477 | + .withLogPrefix("Buyer Message Notice") | ||
478 | + .withInBox(() -> buildInboxContent(inbox, parameters.values().toArray(new Object[0]))) | ||
479 | + .withSmsIf(sms != null, () -> buildSmsContent(sms, params)) | ||
480 | + .withPushIf(push != null, () -> ufoBidMessageService.sendMessage(String.valueOf(buyerUid), push, parameters)) | ||
481 | + .send(); | ||
482 | + } | ||
483 | + | ||
459 | } | 484 | } |
@@ -4,6 +4,8 @@ import com.yohobuy.ufo.model.order.common.OrderStatus; | @@ -4,6 +4,8 @@ import com.yohobuy.ufo.model.order.common.OrderStatus; | ||
4 | import com.yohoufo.dal.order.BuyerOrderMapper; | 4 | import com.yohoufo.dal.order.BuyerOrderMapper; |
5 | import com.yohoufo.dal.order.model.BuyerOrder; | 5 | import com.yohoufo.dal.order.model.BuyerOrder; |
6 | import com.yohoufo.order.BaseWebTest; | 6 | import com.yohoufo.order.BaseWebTest; |
7 | +import com.yohoufo.order.common.Operator; | ||
8 | +import com.yohoufo.order.model.RequestedCancelEventStatusChangeBuyerOrder; | ||
7 | import com.yohoufo.order.service.BuyerOrderStateChangers; | 9 | import com.yohoufo.order.service.BuyerOrderStateChangers; |
8 | import com.yohoufo.order.service.listener.BuyerOrderChangeEvent; | 10 | import com.yohoufo.order.service.listener.BuyerOrderChangeEvent; |
9 | import com.yohoufo.order.service.listener.OrderChangeListenerContainer; | 11 | import com.yohoufo.order.service.listener.OrderChangeListenerContainer; |
@@ -43,8 +45,21 @@ public class BuyerBidOrderServiceTest extends BaseWebTest { | @@ -43,8 +45,21 @@ public class BuyerBidOrderServiceTest extends BaseWebTest { | ||
43 | 45 | ||
44 | @Test | 46 | @Test |
45 | public void test_buyer_close_bid() throws Exception { | 47 | public void test_buyer_close_bid() throws Exception { |
46 | - long orderCode = 10019449511744L; | 48 | + long orderCode = 10029406388043L; |
47 | buyerOrderStateChangers.selectOneToChange(uid, orderCode,OrderStatus.BIDING,OrderStatus.BUYER_CLOSE_BID); | 49 | buyerOrderStateChangers.selectOneToChange(uid, orderCode,OrderStatus.BIDING,OrderStatus.BUYER_CLOSE_BID); |
48 | TimeUnit.SECONDS.sleep(100); | 50 | TimeUnit.SECONDS.sleep(100); |
49 | } | 51 | } |
52 | + | ||
53 | + @Test | ||
54 | + public void test_buyer_pay_timeout() throws Exception { | ||
55 | + long orderCode = 10029406388043L; | ||
56 | + BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCodeUid(orderCode, uid); | ||
57 | + RequestedCancelEventStatusChangeBuyerOrder statusChangeBuyerOrder = new RequestedCancelEventStatusChangeBuyerOrder(buyerOrder, | ||
58 | + OrderStatus.WAITING_PAY, | ||
59 | + OrderStatus.BUYER_BID_PAY_TIMEOUT, | ||
60 | + Operator.SYSTEM, | ||
61 | + null); | ||
62 | + buyerOrderStateChangers.selectOneToChange(statusChangeBuyerOrder); | ||
63 | + TimeUnit.SECONDS.sleep(100); | ||
64 | + } | ||
50 | } | 65 | } |
-
Please register or login to post a comment