Merge branch 'dev-fofp' into test6.9.8
Showing
4 changed files
with
34 additions
and
2 deletions
@@ -18,6 +18,9 @@ public class BuyerOrderSubmitResult { | @@ -18,6 +18,9 @@ public class BuyerOrderSubmitResult { | ||
18 | 18 | ||
19 | long orderCode; | 19 | long orderCode; |
20 | 20 | ||
21 | + //提交时间 == 订单创建时间 | ||
22 | + int submitTime; | ||
23 | + | ||
21 | SellerOrder sellerOrder; | 24 | SellerOrder sellerOrder; |
22 | 25 | ||
23 | SellerOrderGoods sellerOrderGoods; | 26 | SellerOrderGoods sellerOrderGoods; |
@@ -507,6 +507,7 @@ public class ShoppingServiceImpl implements IShoppingService { | @@ -507,6 +507,7 @@ public class ShoppingServiceImpl implements IShoppingService { | ||
507 | buyerOrder.setUid(uid); | 507 | buyerOrder.setUid(uid); |
508 | buyerOrder.setOrderCode(orderCode); | 508 | buyerOrder.setOrderCode(orderCode); |
509 | buyerOrder.setAmount(orderBuilder.getAmount()); | 509 | buyerOrder.setAmount(orderBuilder.getAmount()); |
510 | + buyerOrder.setCreateTime(submitResult.getSubmitTime()); | ||
510 | orderChangeListenerContainer.fireAsyncEvent(new BuyerOrderChangeEvent(buyerOrder, BuyerOrderChangeEvent.BizCase.CREATE, OrderStatus.HAS_PAYED)); | 511 | orderChangeListenerContainer.fireAsyncEvent(new BuyerOrderChangeEvent(buyerOrder, BuyerOrderChangeEvent.BizCase.CREATE, OrderStatus.HAS_PAYED)); |
511 | 512 | ||
512 | //clean cache | 513 | //clean cache |
@@ -169,7 +169,7 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService { | @@ -169,7 +169,7 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService { | ||
169 | SellerOrder sellerOrder = selectSellerOrder(orderBuilder); | 169 | SellerOrder sellerOrder = selectSellerOrder(orderBuilder); |
170 | 170 | ||
171 | // 3.插入订单 表buyer_order | 171 | // 3.插入订单 表buyer_order |
172 | - insertOrder(orderBuilder, sellerOrder.getUid()); | 172 | + BuyerOrder buyerOrder = insertOrder(orderBuilder, sellerOrder.getUid()); |
173 | 173 | ||
174 | // 4.插入订单商品 buyer_order_goods | 174 | // 4.插入订单商品 buyer_order_goods |
175 | insertOrderGoods(orderBuilder); | 175 | insertOrderGoods(orderBuilder); |
@@ -186,6 +186,7 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService { | @@ -186,6 +186,7 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService { | ||
186 | 186 | ||
187 | BuyerOrderSubmitResult result = BuyerOrderSubmitResult.builder() | 187 | BuyerOrderSubmitResult result = BuyerOrderSubmitResult.builder() |
188 | .orderCode(orderBuilder.getOrderCode()) | 188 | .orderCode(orderBuilder.getOrderCode()) |
189 | + .submitTime(buyerOrder.getCreateTime()) | ||
189 | .sellerOrder(sellerOrder) | 190 | .sellerOrder(sellerOrder) |
190 | .sellerOrderGoods(orderBuilder.getSellerOrderGoods()).build(); | 191 | .sellerOrderGoods(orderBuilder.getSellerOrderGoods()).build(); |
191 | 192 | ||
@@ -253,7 +254,7 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService { | @@ -253,7 +254,7 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService { | ||
253 | buyerOrderGoodsMapper.insertSelective(buyerOrderGoods); | 254 | buyerOrderGoodsMapper.insertSelective(buyerOrderGoods); |
254 | } | 255 | } |
255 | 256 | ||
256 | - private void insertOrder(OrderBuilder orderBuilder, int sellerUid) { | 257 | + private BuyerOrder insertOrder(OrderBuilder orderBuilder, int sellerUid) { |
257 | BuyerOrder buyerOrder = new BuyerOrder(); | 258 | BuyerOrder buyerOrder = new BuyerOrder(); |
258 | buyerOrder.setUid(orderBuilder.getUid()); | 259 | buyerOrder.setUid(orderBuilder.getUid()); |
259 | buyerOrder.setOrderCode(orderBuilder.getOrderCode()); | 260 | buyerOrder.setOrderCode(orderBuilder.getOrderCode()); |
@@ -277,6 +278,7 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService { | @@ -277,6 +278,7 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService { | ||
277 | //活动类型 | 278 | //活动类型 |
278 | buyerOrder.setActivityType(orderBuilder.getActivityBo().getActivityType()); | 279 | buyerOrder.setActivityType(orderBuilder.getActivityBo().getActivityType()); |
279 | buyerOrderMapper.insert(buyerOrder); | 280 | buyerOrderMapper.insert(buyerOrder); |
281 | + return buyerOrder; | ||
280 | } | 282 | } |
281 | 283 | ||
282 | private void insertOrderCouponIfNeed(OrderBuilder orderBuilder) { | 284 | private void insertOrderCouponIfNeed(OrderBuilder orderBuilder) { |
1 | package com.yohoufo.order.service.listener.processor; | 1 | package com.yohoufo.order.service.listener.processor; |
2 | 2 | ||
3 | +import com.alibaba.fastjson.JSONObject; | ||
3 | import com.google.common.collect.Lists; | 4 | import com.google.common.collect.Lists; |
5 | +import com.yoho.core.rabbitmq.YhProducer; | ||
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.alarm.SmsAlarmEvent; | 8 | import com.yohoufo.common.alarm.SmsAlarmEvent; |
@@ -16,6 +18,7 @@ import org.slf4j.Logger; | @@ -16,6 +18,7 @@ import org.slf4j.Logger; | ||
16 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
17 | import org.springframework.stereotype.Component; | 19 | import org.springframework.stereotype.Component; |
18 | 20 | ||
21 | +import javax.annotation.Resource; | ||
19 | import java.util.List; | 22 | import java.util.List; |
20 | import java.util.Objects; | 23 | import java.util.Objects; |
21 | 24 | ||
@@ -36,8 +39,12 @@ public class BuyerOrderChangeBusinessPostProcessor { | @@ -36,8 +39,12 @@ public class BuyerOrderChangeBusinessPostProcessor { | ||
36 | @Autowired | 39 | @Autowired |
37 | private BargainProxyService bargainProxyService; | 40 | private BargainProxyService bargainProxyService; |
38 | 41 | ||
42 | + @Resource( name = "ufoExpressInfoProducer") | ||
43 | + private YhProducer ufoExpressInfoProducer; | ||
44 | + | ||
39 | //业务处理器 | 45 | //业务处理器 |
40 | private List<BusinessProcessor> processors = Lists.newArrayList( | 46 | private List<BusinessProcessor> processors = Lists.newArrayList( |
47 | + new NotifyProcessor(), | ||
41 | new DefaultBusinessProcessor(), | 48 | new DefaultBusinessProcessor(), |
42 | //砍价 | 49 | //砍价 |
43 | new BargainBusinessProcessor() | 50 | new BargainBusinessProcessor() |
@@ -181,6 +188,25 @@ public class BuyerOrderChangeBusinessPostProcessor { | @@ -181,6 +188,25 @@ public class BuyerOrderChangeBusinessPostProcessor { | ||
181 | } | 188 | } |
182 | } | 189 | } |
183 | 190 | ||
191 | + | ||
192 | + /** | ||
193 | + * 下单通知 | ||
194 | + */ | ||
195 | + private class NotifyProcessor extends BusinessProcessorAdapter { | ||
196 | + private static final String TOPIC = "ufo.notify.buyerOrder"; | ||
197 | + | ||
198 | + @Override | ||
199 | + public void create(BusinessProcessorContext context) { | ||
200 | + BuyerOrder buyerOrder = context.buyerOrder; | ||
201 | + JSONObject jsonObject = new JSONObject(); | ||
202 | + jsonObject.put("uid", buyerOrder.getUid()); | ||
203 | + jsonObject.put("orderCode", buyerOrder.getOrderCode()); | ||
204 | + jsonObject.put("createTime", buyerOrder.getCreateTime()); | ||
205 | + ufoExpressInfoProducer.send(TOPIC, jsonObject); | ||
206 | + } | ||
207 | + } | ||
208 | + | ||
209 | + | ||
184 | //默认业务处理 | 210 | //默认业务处理 |
185 | private class DefaultBusinessProcessor extends BusinessProcessorAdapter { | 211 | private class DefaultBusinessProcessor extends BusinessProcessorAdapter { |
186 | @Override | 212 | @Override |
-
Please register or login to post a comment