mq.md 10.9 KB

MQ

简介

生产者/消费者 TOPIC 使用场景
生产者 order.submit 用户下单、JIT拆单
生产者 order.payment 用户支付完成
生产者 order.orderStatus 用户确认收货、用户取消订单、系统自动取消订单
消费者 order.erpstatus 订单已审核、已备货、已交寄、已妥投、客服取消、ERP系统自动取消
生产者 order.createChangeOrder 前台创建换货单
消费者 erp.createChangeOrder ERP创建换货单
生产者 order.updateChangeRefundOrderExpressInfo 用户更新换货订单快递信息、用户更新退货订单快递信息
消费者 erp.updateChangeRefundOrderStatus ERP退换货状态变更
生产者 order.createRefundOrder 前台创建退货单
消费者 erp.createRefundOrder ERP创建退货单
生产者 order.changeRefundCancel 用户取消退货单、用户取消换货单
生产者 order.deliveryAddress 用户修改收货地址
消费者 erp.deliveryAddressUpdate 客服修改收货地址、支付方式、发票类型
消费者 erp.updateInvoicePdfUrl 更新电子发票开票信息
消费者 order.updateExpressInfo 更新物流信息

发布消息到监控系统

接口说明 接口说明
接口名 /erp/order/publishRabbitmqSentEvent
接口说明 发送MQ消息到监控系统
http请求方式 POST

请求参数

名称 类型 是否必须 示例值 默认值 描述
topic string order.erpstatus
body string {"uid":1111,"order_code":111111,"status":901}

备注

可异步调用,无须关注返回结果

前台订单状态同步

MQ消息数据结构

参数
exchanges amq.topic
route key order.orderStatus

确认订单

{"orderCode":100000,"status":700}

用户主动取消

{"orderCode":100000,"status":900}

系统自动取消

{"orderCode":100000,"status":906}

订单状态同步

MQ消息数据结构

参数
exchanges amq.topic
route key order.erpstatus

已审核

{"uid":111111,"order_code":100000,"status":100}

已备货

{"uid":111111,"order_code":100000,"status":200}

已交寄

{
    "uid":111111,
    "order_code":100000,
    "status":600,
    "data":{
        "express_id": 23,
        "express_number":"25276134639"
    }
}

订单妥投

{"uid":111111,"order_code":100000,"status":700}

客服取消

{"uid":111111,"order_code":100000,"status":901}

系统自动取消

{"uid":111111,"order_code":100000,"status":906}

定金预售尾款支付通知

{"uid":111111,"order_code":100000,"status":40}

前台创建换货单

MQ消息数据结构

参数
exchanges amq.topic
route key order.createChangeOrder
{
    "id": 1,
    "city": "南京市",
    "area_code": "320115",
    "address": "江宁经济技术开发区苏源大道87号(有货物流中心订单组)",
    "consignee_name": "测试",
    "county": "江宁区",
    "delivery_tpye": 10,
    "email": "",
    "exchange_mode": 10,
    "mobile": "13776693005",
    "order_code": 16062099,
    "init_order_code": 16062099,
    "source_order_code": 16062099,
    "province": "江苏省",
    "receipt_time": "2",
    "remark": "用户换货",
    "uid": 8041518,
    "zip_code": "211100",
    "goods": [
        {
            "exchange_reason": "3",
            "goods_type": "1",
            "last_price": "88.00",
            "new_goods_id": 354687,
            "new_product_skc": 279434,
            "new_product_sku": 892152,
            "product_skc": 279434,
            "product_skn": 51152761,
            "product_sku": 892152,
            "remark": ""
        }
    ]
}

ERP创建换货单

MQ消息数据结构

参数
exchanges amq.topic
route key erp.createChangeOrder

成功

{
    "code": 200,
    "message": "ok",
    "data": {
        "id": 1,
        "init_order_code": "111",
        "source_order_code": 1111,
        "new_order_code": 1111,
        "exchange_id": 111,
        "returned_id": 111,
        "exchange_status": 10,
        "returned_status": 10
    }
}

客服驳回

{
    "code":500,
    "message":"error",
    "data":{
        "id": 1,
        "init_order_code": "111",
        "source_order_code": 1111,
        "new_order_code": 1111,
        "exchange_id": 111,
        "returned_id": 111,
        "exchange_status": 91,  // 客服驳回
        "returned_status": 91   // 客服驳回
    }
}

前台更新退换货快递信息

MQ消息数据结构

参数
exchanges amq.topic
route key order.updateChangeRefundOrderExpressInfo

换货消息

{   
    // 前台换货单唯一主键
    "id": 1,
    "uid": 1111,
    // ERP换货单唯一主键
    "apply_id": 40,
    "express_number": "603596395359",
    "express_name": "顺丰",
    "express_id": 23,
    // 表示类型为换货
    "type": "change"
}

退货消息

{   
    // 前台退货单唯一主键
    "order_returned_id": 1,
    "uid": 1111,
    // erp退货单唯一主键
    "apply_id": 40,              
    "express_number": "603596395359",
    "express_name": "顺丰",
    "express_id": 23,
    // 表示类型为退货
    "type": "refund"            
}

ERP更新换货单状态

MQ消息数据结构

参数
exchanges amq.topic
route key erp.updateChangeRefundOrderStatus

审核通过

{
    // erp系统换货单唯一主键
    "id": 1,
    "status": 10,
    // "change" 表示换货类型,"refund"表示退货类型
    "type": "change"
}

商品入库(仅商品寄回发该状态)

{
    "id":1,        // id为erp系统换货单id唯一主键
    "status":30,
    "type":"change"     //"change" 表示换货类型,"refund"表示退货类型
}

上门换货(仅上门换货发该状态)

{
    "id":1,        // id为erp系统换货单id唯一主键
    "status":40,
    "type":"change"     //"change" 表示换货类型,"refund"表示退货类型
}

换货完成

{
    "id":1,        // id为erp系统换货单id唯一主键
    "status":50,
    "type":"change"     //"change" 表示换货类型,"refund"表示退货类型
}

前台创建退货单

MQ消息数据结构

参数
exchanges amq.topic
route key order.createRefundOrder
{
    "uid": "3342109",
    "alipay_account": "13912008849",
    "alipay_name": "xxxx",
    "area_code": "area_code",
    "bank_card": "6228480605428963215",
    "bank_id": "5",
    "head_bank_name": "中国银行",
    "bank_name": "xx支行",
    "city": "南京市",
    "county": "",
    "order_code": "308545172",
    "payee_name": "张璐",
    "province": "江苏省",
    "remark": "尺寸不合适",
    "return_amount_mode": "2",
    "order_returned_id":123,//前台表生成的退货订单主键,其余字段同老接口
    "returned_goods_list": [
        {
            "product_sku": "383669",
            "goods_type": "1",
            "last_price": "334",
            "returned_reason": "1",
            "remark": "尺寸不合适",
            "evidence_images": ""
        }
    ]
}

ERP创建退货单

MQ消息数据结构

参数
exchanges amq.topic
route key erp.createRefundOrder

成功

{
    "code": 200,
    "message": "ok",
    "data": {
        "id":1,                     //前台退货id唯一主键
        "returned_id":1,            //returned_id为erp退货id唯一主键
        "returned_status":10,
        "real_returned_amount":100,
        "is_return_coupon":"N",
        "return_yoho_coin":11111
    }
}

客服驳回

{
    "code":500,
    "message":"error",
    "data":{
        "id":1,                      //id为前台退货id唯一主键
        "returned_id":1,            //returned_id为erp退货id唯一主键
        "returned_status":91       //客服驳回
    }
}

ERP更新退货单状态

MQ消息数据结构

参数
exchanges amq.topic
route key erp.updateChangeRefundOrderStatus
{
    "id":1,        // id 为erp系统退货单id唯一主键
    "status":40,            // 0:提交、10:审核通过、20:商品寄回、30:已入库、40:付款结束、91:客服拒退
    "type":"refund",        // change:表示换货类型、refund:表示退货类型
    "real_returned_amount":100,
    "is_return_coupon":"N",
    "return_yoho_coin":11111
}

取消退换货

MQ消息数据结构

参数
exchanges amq.topic
route key order.changeRefundCancel
{"id": 428013,  //erp的退货主键,  或者换货主键 ,根据type传不同的值
"status":900, //表示用户主动取消状态
"type":1  //1表示退货,2表示换货
}

修改订单收货地址

MQ消息数据结构

参数
exchanges amq.topic
route key order.deliveryAddress
[{
    "address": "靖南大街688-10号2楼",
    "address_id": 61,
    "area_code": 330225,
    "city": "宁波市",
    "district": "象山县",
    "email": "canvas220@sina.com",
    "mobile": "15258109727",
    "order_code": 1607472719,
    "parent_order_code": 123,
    "phone": "057465772167",
    "province": "浙江省",
    "user_name": "朱倩倩",
    "zip_code": 315700
}]

客服修改订单信息

MQ消息数据结构

参数
exchanges amq.topic
route key erp.deliveryAddressUpdate
[{
    "address": "靖南大街688-10号2楼",
    "address_id": 61,
    "area_code": 330225,
    "city": "宁波市",
    "district": "象山县",
    "email": "canvas220@sina.com",
    "mobile": "15258109727",
    "order_code": 1607472719,
    "parent_order_code": 123,
    "phone": "057465772167",
    "province": "浙江省",
    "user_name": "朱倩倩",
    "zip_code": 315700
}]

更新电子发票开票信息

MQ消息数据结构

参数
exchanges amq.topic
route key erp.updateInvoicePdfUrl

{
    "uid": 8050310,
    "orderCode": 1607578151,
    "pdfUrl": "www.baidu.com/url",
    "invoiceType": "1" //开票方式 0:蓝票, 1:红票 
}

更新物流信息

MQ消息数据结构

参数
exchanges amq.topic
route key order.updateExpressInfo

{
    "uid": 8050310,
    "acceptAddress":"郑州市",
    "acceptRemark":"快件在 郑州总集散中心 ,准备送往下一站",
    "businessType":1,
    "createTime":1483387378,
    "dealWithCost":0,
    "id":26827984,
    "logisticsType":23,
    "orderCode":1718050455,
    "state":0,
    "uniqueKey":"15415544bd03c309e7f44919d5b926a4",
    "waybillCode":"612037714591"
}