Authored by wujiexiang

Merge branch 'dev-fofp' into test6.9.8

... ... @@ -18,6 +18,9 @@ public class BuyerOrderSubmitResult {
long orderCode;
//提交时间 == 订单创建时间
int submitTime;
SellerOrder sellerOrder;
SellerOrderGoods sellerOrderGoods;
... ...
... ... @@ -507,6 +507,7 @@ public class ShoppingServiceImpl implements IShoppingService {
buyerOrder.setUid(uid);
buyerOrder.setOrderCode(orderCode);
buyerOrder.setAmount(orderBuilder.getAmount());
buyerOrder.setCreateTime(submitResult.getSubmitTime());
orderChangeListenerContainer.fireAsyncEvent(new BuyerOrderChangeEvent(buyerOrder, BuyerOrderChangeEvent.BizCase.CREATE, OrderStatus.HAS_PAYED));
//clean cache
... ...
... ... @@ -169,7 +169,7 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService {
SellerOrder sellerOrder = selectSellerOrder(orderBuilder);
// 3.插入订单 表buyer_order
insertOrder(orderBuilder, sellerOrder.getUid());
BuyerOrder buyerOrder = insertOrder(orderBuilder, sellerOrder.getUid());
// 4.插入订单商品 buyer_order_goods
insertOrderGoods(orderBuilder);
... ... @@ -186,6 +186,7 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService {
BuyerOrderSubmitResult result = BuyerOrderSubmitResult.builder()
.orderCode(orderBuilder.getOrderCode())
.submitTime(buyerOrder.getCreateTime())
.sellerOrder(sellerOrder)
.sellerOrderGoods(orderBuilder.getSellerOrderGoods()).build();
... ... @@ -253,7 +254,7 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService {
buyerOrderGoodsMapper.insertSelective(buyerOrderGoods);
}
private void insertOrder(OrderBuilder orderBuilder, int sellerUid) {
private BuyerOrder insertOrder(OrderBuilder orderBuilder, int sellerUid) {
BuyerOrder buyerOrder = new BuyerOrder();
buyerOrder.setUid(orderBuilder.getUid());
buyerOrder.setOrderCode(orderBuilder.getOrderCode());
... ... @@ -277,6 +278,7 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService {
//活动类型
buyerOrder.setActivityType(orderBuilder.getActivityBo().getActivityType());
buyerOrderMapper.insert(buyerOrder);
return buyerOrder;
}
private void insertOrderCouponIfNeed(OrderBuilder orderBuilder) {
... ...
package com.yohoufo.order.service.listener.processor;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.yoho.core.rabbitmq.YhProducer;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohoufo.common.alarm.EventBusPublisher;
import com.yohoufo.common.alarm.SmsAlarmEvent;
... ... @@ -16,6 +18,7 @@ import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;
... ... @@ -36,8 +39,12 @@ public class BuyerOrderChangeBusinessPostProcessor {
@Autowired
private BargainProxyService bargainProxyService;
@Resource( name = "ufoExpressInfoProducer")
private YhProducer ufoExpressInfoProducer;
//业务处理器
private List<BusinessProcessor> processors = Lists.newArrayList(
new NotifyProcessor(),
new DefaultBusinessProcessor(),
//砍价
new BargainBusinessProcessor()
... ... @@ -181,6 +188,25 @@ public class BuyerOrderChangeBusinessPostProcessor {
}
}
/**
* 下单通知
*/
private class NotifyProcessor extends BusinessProcessorAdapter {
private static final String TOPIC = "ufo.notify.buyerOrder";
@Override
public void create(BusinessProcessorContext context) {
BuyerOrder buyerOrder = context.buyerOrder;
JSONObject jsonObject = new JSONObject();
jsonObject.put("uid", buyerOrder.getUid());
jsonObject.put("orderCode", buyerOrder.getOrderCode());
jsonObject.put("createTime", buyerOrder.getCreateTime());
ufoExpressInfoProducer.send(TOPIC, jsonObject);
}
}
//默认业务处理
private class DefaultBusinessProcessor extends BusinessProcessorAdapter {
@Override
... ...