Commit 41ef2235 by 周晓航

Merge branch 'feature/20210526-有数上报功能迁移-周晓航'

parents e8e8af7b ca558f4d
......@@ -35,6 +35,11 @@ public class OrderCallBackConfig {
public static final String INVOICE_QUEUE = "invoice-report-queue";
public static final String INVOICE_ROUTE_KEY = "invoice-report-queue-routing-key";
// 腾讯有数上报 & 门店营业开店记录 发送到 ordercenter-order组的 mq中
public static final String SEND_YOUSHU_REPORT_QUEUE_ROUTING_KEY="send-youshu-report-queue-routing-key";
public static final String SEND_YOUSHU_REPORT_QUEUE="send-youshu-report-queue";
/**
* 定义基于Fanout 的Exchange。
* 基于这个代码,也可以非常方便的定义其他的Exchange类型。
......@@ -114,4 +119,18 @@ public class OrderCallBackConfig {
Binding bindingInvoiceQueue(@Qualifier("invoiceQueue") Queue invoiceQueue,@Qualifier("invoiceExchange") Exchange invoiceExchange) {
return BindingBuilder.bind(invoiceQueue).to(invoiceExchange).with(INVOICE_ROUTE_KEY).noargs();
}
/**
* 有数上报/ 支付门店 queue 绑定
* @return
*/
@Bean(name = "sendWechatReportQueue")
public Queue sendWechatReportQueue() {
return QueueBuilder.durable(SEND_YOUSHU_REPORT_QUEUE).build();
}
@Bean
Binding bindingSendWechatReportQueue(@Qualifier("sendWechatReportQueue") Queue sendWechatReportQueue, @Qualifier("topicExchange") Exchange topicExchange) {
return BindingBuilder.bind(sendWechatReportQueue).to(topicExchange).with(SEND_YOUSHU_REPORT_QUEUE_ROUTING_KEY).noargs();
}
}
......@@ -96,6 +96,8 @@ public class OrderCallBackMQService {
}else{
revert(body);
}
// 有数订单数据上报 & 每日下单门店统计
sendYoushuReportMQ(body);
}
/**
......@@ -336,4 +338,26 @@ public class OrderCallBackMQService {
return false;
}
/**
* 有数上报MQ
* @param body
*/
private void sendYoushuReportMQ(OrderCallBackRequestVo body) {
try {
if (Objects.isNull(body) || StringUtils.isEmpty(body.getContent())) {
return;
}
logger.info("send youshu report MQ orderCode:{} body:{} ", body.getOrderCode(), body);
// 正常变化 订单正向操作 fisherman 检查下
if (body.getOperateType() == 1 && "1".equals(body.getMsgType())) {
Header header = new Header(MQAction.UPDATE.getAction(), "call-back-service-api",
OrderCallBackConfig.SEND_YOUSHU_REPORT_QUEUE_ROUTING_KEY, OrderCallBackConfig.SEND_YOUSHU_REPORT_QUEUE);
MQMessage<OrderCallBackRequestVo> message = new MQMessage<>(header, body);
mqService.convertAndSend(OrderCallBackConfig.TOPIC_EXCHANGE_NAME, OrderCallBackConfig.SEND_YOUSHU_REPORT_QUEUE_ROUTING_KEY, message);
}
}catch (Exception e){
logger.info("send youshu report MQ ERROR :{}", JSON.toJSONString(e));
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment