|
|
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
|
...
|
...
|
|