后端接口开发-订单管理模块

第一部分: 前台接口

1. 方法范例

  • 请求路径: /cart/list.do
  • 请求方法:GET
  • 请求参数:

  • 响应成功
  • 响应失败
  1. 根据收货地址创建订单
  • 请求路径: /order/create.do

  • 请求方法:POST

  • 请求参数:

shppingId,也就是收货地址编号

  • 响应成功
{
    "status": 0,
    "data": {
        "orderNo": 1589034101339, //订单编号,尽量避免并发重复
        "payment": 102980.0, //订单总金额
        "paymentType": 1,		//支付类型编号,1是在线支付
        "paymentTypeDesc": "在线支付",//支付类型描述
        "postage": 0,//运费,默认为0,不用管
        "status": 10,//订单状态:0-已取消-10-未付款,20-已付款,40-已发货,50-交易成功,60-交易关闭,
        "statusDesc": "未支付",//订单状态描述
        "paymentTime": "",//支付时间,未支付所以为空
        "sendTime": "",//发货时间,还没有发货,所以为空
        "endTime": null,//订单结束时间
        "closeTime": "",//订单关闭时间
        "createTime": "2020-05-09 22:21:41",//订单创建时间
        "orderItemVoList": [//订单明细列表,一个订单包含多个订单明细,一个订单明细代表订单中一种商品的详细信息
            {
                "userId": 1,//用户编号
                "orderNo": 1589034101339,//订单编号
                "productId": 26,//产品编号
                "productName": "Apple iPhone 7 Plus (A1661) 128G 玫瑰金色 移动联通电信4G手机",//产品名
                "productImage": "626dceb4-398e-481b-80e5-4339c3708a6e.jpg",//产品主图
                "currentUnitPrice": 6999.00,//产品价格
                "quantity": 10,//产品购买数量
                "totalPrice": 69990.00,//该商品总共话费
                "createTime": "2020-05-09 22:21:41"//创建时间
            },
            {
                "userId": 1,
                "orderNo": 1589034101339,
                "productId": 27,
                "productName": "Midea/美的 BCD-535WKZM(E)冰箱双开门对开门风冷无霜智能电家用",
                "productImage": "626dceb4-398e-481b-80e5-4339c3708a6e.jpg",
                "currentUnitPrice": 3299.00,
                "quantity": 10,
                "totalPrice": 32990.00,
                "createTime": "2020-05-09 22:21:41"
            }
        ],
        "shippingVo": {//收货地址模块
            "receiverName": "李登印",//收货人
            "receiverPhone": "18354131190",//收获电话
            "receiverMobile": "83582409",//收获手机
            "receiverProvince": "山东",//省
            "receiverCity": "济南",//市
            "receiverDistrict": "章丘区",//县/区
            "receiverAddress": "高管寨1",//街道/镇
            "receiverZip": "250209"//邮编
        },
        "imageHost": "ftp://121.36.145.230/",//图片服务器前缀
        "receiverName": "李登印",//收货人
        "shippingId": 37//收货信息ID
    }
}
  • 响应失败
{
    "status": 1,
    "msg": "创建订单失败"
}
{
    "status": 1,
    "msg": "购物车为空"
}
  1. 购物车确定购买时的订单预览
  • 请求路径: /order/get_order_cart_product.do
  • 请求方法:POST
  • 请求参数:

  • 响应成功
{
    "status": 0,
    "data": {
        "orderItemVoList": [
            {
                "userId": 1,
                "orderNo": null,
                "productId": 27,
                "productName": "Midea/美的 BCD-535WKZM(E)冰箱双开门对开门风冷无霜智能电家用",
                "productImage": "626dceb4-398e-481b-80e5-4339c3708a6e.jpg",
                "currentUnitPrice": 3299.00,
                "quantity": 20,
                "totalPrice": 65980.00,
                "createTime": ""
            },
            {
                "userId": 1,
                "orderNo": null,
                "productId": 26,
                "productName": "Apple iPhone 7 Plus (A1661) 128G 玫瑰金色 移动联通电信4G手机",
                "productImage": "626dceb4-398e-481b-80e5-4339c3708a6e.jpg",
                "currentUnitPrice": 6999.00,
                "quantity": 10,
                "totalPrice": 69990.00,
                "createTime": ""
            }
        ],
        "productTotalPrice": 135970.0,
        "imageHost": "ftp://121.36.145.230/"
    }
}
  • 响应失败
{
    "status": 1,
    "msg": "用户未登录"
}
  1. 分页获取订单列表
  • 请求路径: /order/list.do
  • 请求方法:GET
  • 请求参数:

  • 响应成功
    因为测试时订单太多,所以删除之后剩下下面这一个,具体参数的含义参考第一个接口
{
    "status": 0,
    "data": {
        "total": 25,//分页总行数
        "list": [
            {
                "orderNo": 1589033589207,//订单编号
                "payment": 308940.00,//订单总金额
                "paymentType": 1,
                "paymentTypeDesc": "在线支付",
                "postage": 0,
                "status": 10,
                "statusDesc": "未支付",
                "paymentTime": "",
                "sendTime": "",
                "endTime": null,
                "closeTime": "",
                "createTime": "2020-05-10 11:13:09",
                "orderItemVoList": [
                    {
                        "userId": 1,
                        "orderNo": 1589033589207,
                        "productId": 26,
                        "productName": "Apple iPhone 7 Plus (A1661) 128G 玫瑰金色 移动联通电信4G手机",
                        "productImage": "626dceb4-398e-481b-80e5-4339c3708a6e.jpg",
                        "currentUnitPrice": 6999.00,
                        "quantity": 30,
                        "totalPrice": 209970.00,
                        "createTime": "2020-05-10 11:13:09"
                    },
                    {
                        "userId": 1,
                        "orderNo": 1589033589207,
                        "productId": 27,
                        "productName": "Midea/美的 BCD-535WKZM(E)冰箱双开门对开门风冷无霜智能电家用",
                        "productImage": "626dceb4-398e-481b-80e5-4339c3708a6e.jpg",
                        "currentUnitPrice": 3299.00,
                        "quantity": 30,
                        "totalPrice": 98970.00,
                        "createTime": "2020-05-10 11:13:09"
                    }
                ],
        "pageNum": 1,
        "pageSize": 10,
        "size": 10,
        "startRow": 1,
        "endRow": 10,
        "pages": 3,
        "prePage": 0,
        "nextPage": 2,
        "isFirstPage": true,
        "isLastPage": false,
        "hasPreviousPage": false,
        "hasNextPage": true,
        "navigatePages": 8,
        "navigatepageNums": [
            1,
            2,
            3
        ],
        "navigateFirstPage": 1,
        "navigateLastPage": 3
    }
}
  • 响应失败
{
  "status": 10,
  "msg": "用户未登录,请登录"
}{
  "status": 1,
  "msg": "没有权限"
}



  1. 根据订单编号查看订单详情
  • 请求路径: /order/detail.do
  • 请求方法:GET
  • 请求参数:

orderNo,订单编号

  • 响应成功
{
    "status": 0,
    "data": {
        "orderNo": 1589032902159,
        "payment": 168960.00,
        "paymentType": 1,
        "paymentTypeDesc": "在线支付",
        "postage": 0,
        "status": 10,
        "statusDesc": "未支付",
        "paymentTime": "",
        "sendTime": "",
        "endTime": null,
        "closeTime": "",
        "createTime": "2020-05-10 11:01:42",
        "orderItemVoList": [
            {
                "userId": 1,
                "orderNo": 1589032902159,
                "productId": 27,
                "productName": "Midea/美的 BCD-535WKZM(E)冰箱双开门对开门风冷无霜智能电家用",
                "productImage": "626dceb4-398e-481b-80e5-4339c3708a6e.jpg",
                "currentUnitPrice": 3299.00,
                "quantity": 30,
                "totalPrice": 98970.00,
                "createTime": "2020-05-10 11:01:42"
            },
            {
                "userId": 1,
                "orderNo": 1589032902159,
                "productId": 26,
                "productName": "Apple iPhone 7 Plus (A1661) 128G 玫瑰金色 移动联通电信4G手机",
                "productImage": "626dceb4-398e-481b-80e5-4339c3708a6e.jpg",
                "currentUnitPrice": 6999.00,
                "quantity": 10,
                "totalPrice": 69990.00,
                "createTime": "2020-05-10 11:01:42"
            }
        ],
        "shippingVo": {
            "receiverName": "李登印",
            "receiverPhone": "18354131190",
            "receiverMobile": "83582409",
            "receiverProvince": "山东",
            "receiverCity": "济南",
            "receiverDistrict": "章丘区",
            "receiverAddress": "高管寨1",
            "receiverZip": "250209"
        },
        "imageHost": "ftp://121.36.145.230/",
        "receiverName": "李登印",
        "shippingId": 37
    }
}
  • 响应失败
{
  "status": 1,
  "msg": "没有找到订单"
}
  1. 取消订单
  • 请求路径: /order/cancel.do
  • 请求方法:PUT
  • 请求参数:

orderNo,订单编号

  • 响应成功
{
    "status": 0
}
  • 响应失败
{
  "status": 1,
  "msg": "该用户没有此订单"
}{
  "status": 1,
  "msg": "此订单已付款,无法被取消"
}

第二部分:后台部分

  1. 管理员分页获取全部订单列表
  • 请求路径: /manage/order/list.do
  • 请求方法:POST
  • 请求参数:

pageSize(default=10),每页大小
pageNum(default=1),当前页码

  • 响应成功
    依旧是测试删减版本,完全的测试数据太多了
{
    "status": 0,
    "data": {
        "total": 25,
        "list": [
            {
                "orderNo": 1589033589207,
                "payment": 308940.00,
                "paymentType": 1,
                "paymentTypeDesc": "在线支付",
                "postage": 0,
                "status": 10,
                "statusDesc": "未支付",
                "paymentTime": "",
                "sendTime": "",
                "endTime": null,
                "closeTime": "",
                "createTime": "2020-05-10 11:13:09",
                "orderItemVoList": [
                    {
                        "userId": 1,
                        "orderNo": 1589033589207,
                        "productId": 26,
                        "productName": "Apple iPhone 7 Plus (A1661) 128G 玫瑰金色 移动联通电信4G手机",
                        "productImage": "626dceb4-398e-481b-80e5-4339c3708a6e.jpg",
                        "currentUnitPrice": 6999.00,
                        "quantity": 30,
                        "totalPrice": 209970.00,
                        "createTime": "2020-05-10 11:13:09"
                    },
                    {
                        "userId": 1,
                        "orderNo": 1589033589207,
                        "productId": 27,
                        "productName": "Midea/美的 BCD-535WKZM(E)冰箱双开门对开门风冷无霜智能电家用",
                        "productImage": "626dceb4-398e-481b-80e5-4339c3708a6e.jpg",
                        "currentUnitPrice": 3299.00,
                        "quantity": 30,
                        "totalPrice": 98970.00,
                        "createTime": "2020-05-10 11:13:09"
                    }
                ],
                "shippingVo": {
                    "receiverName": "李登印",
                    "receiverPhone": "18354131190",
                    "receiverMobile": "83582409",
                    "receiverProvince": "山东",
                    "receiverCity": "济南",
                    "receiverDistrict": "章丘区",
                    "receiverAddress": "高管寨1",
                    "receiverZip": "250209"
                },
                "imageHost": "ftp://121.36.145.230/",
                "receiverName": "李登印",
                "shippingId": 37
            },
            {
                "orderNo": 1589032902159,
                "payment": 168960.00,
                "paymentType": 1,
                "paymentTypeDesc": "在线支付",
                "postage": 0,
                "status": 10,
                "statusDesc": "未支付",
                "paymentTime": "",
                "sendTime": "",
                "endTime": null,
                "closeTime": "",
                "createTime": "2020-05-10 11:01:42",
                "orderItemVoList": [
                    {
                        "userId": 1,
                        "orderNo": 1589032902159,
                        "productId": 27,
                        "productName": "Midea/美的 BCD-535WKZM(E)冰箱双开门对开门风冷无霜智能电家用",
                        "productImage": "626dceb4-398e-481b-80e5-4339c3708a6e.jpg",
                        "currentUnitPrice": 3299.00,
                        "quantity": 30,
                        "totalPrice": 98970.00,
                        "createTime": "2020-05-10 11:01:42"
                    },
                    {
                        "userId": 1,
                        "orderNo": 1589032902159,
                        "productId": 26,
                        "productName": "Apple iPhone 7 Plus (A1661) 128G 玫瑰金色 移动联通电信4G手机",
                        "productImage": "626dceb4-398e-481b-80e5-4339c3708a6e.jpg",
                        "currentUnitPrice": 6999.00,
                        "quantity": 10,
                        "totalPrice": 69990.00,
                        "createTime": "2020-05-10 11:01:42"
                    }
                ],
                "shippingVo": {
                    "receiverName": "李登印",
                    "receiverPhone": "18354131190",
                    "receiverMobile": "83582409",
                    "receiverProvince": "山东",
                    "receiverCity": "济南",
                    "receiverDistrict": "章丘区",
                    "receiverAddress": "高管寨1",
                    "receiverZip": "250209"
                },
                "imageHost": "ftp://121.36.145.230/",
                "receiverName": "李登印",
                "shippingId": 37
            },
            {
                "orderNo": 1589032894227,
                "payment": 168960.00,
                "paymentType": 1,
                "paymentTypeDesc": "在线支付",
                "postage": 0,
                "status": 10,
                "statusDesc": "未支付",
                "paymentTime": "",
                "sendTime": "",
                "endTime": null,
                "closeTime": "",
                "createTime": "2020-05-10 11:01:34",
                "orderItemVoList": [
                    {
                        "userId": 1,
                        "orderNo": 1589032894227,
                        "productId": null,
                        "productName": "Midea/美的 BCD-535WKZM(E)冰箱双开门对开门风冷无霜智能电家用",
                        "productImage": "626dceb4-398e-481b-80e5-4339c3708a6e.jpg",
                        "currentUnitPrice": 3299.00,
                        "quantity": 30,
                        "totalPrice": 98970.00,
                        "createTime": "2020-05-10 11:01:34"
                    },
                    {
                        "userId": 1,
                        "orderNo": 1589032894227,
                        "productId": null,
                        "productName": "Apple iPhone 7 Plus (A1661) 128G 玫瑰金色 移动联通电信4G手机",
                        "productImage": "626dceb4-398e-481b-80e5-4339c3708a6e.jpg",
                        "currentUnitPrice": 6999.00,
                        "quantity": 10,
                        "totalPrice": 69990.00,
                        "createTime": "2020-05-10 11:01:34"
                    }
                ],
                "shippingVo": {
                    "receiverName": "李登印",
                    "receiverPhone": "18354131190",
                    "receiverMobile": "83582409",
                    "receiverProvince": "山东",
                    "receiverCity": "济南",
                    "receiverDistrict": "章丘区",
                    "receiverAddress": "高管寨1",
                    "receiverZip": "250209"
                },
                "imageHost": "ftp://121.36.145.230/",
                "receiverName": "李登印",
                "shippingId": 37
            }

        ],
        "pageNum": 1,
        "pageSize": 10,
        "size": 10,
        "startRow": 1,
        "endRow": 10,
        "pages": 3,
        "prePage": 0,
        "nextPage": 2,
        "isFirstPage": true,
        "isLastPage": false,
        "hasPreviousPage": false,
        "hasNextPage": true,
        "navigatePages": 8,
        "navigatepageNums": [
            1,
            2,
            3
        ],
        "navigateFirstPage": 1,
        "navigateLastPage": 3
    }
}
  • 响应失败
{
  "status": 10,
  "msg": "用户未登录,请登录"
}{
  "status": 1,
  "msg": "没有权限"
}

  1. 根据订单号分页查询订单
  • 请求路径: /manage/order/search.do
  • 请求方法:POST
  • 请求参数:

orderNo

  • 响应成功
{
    "status": 0,
    "data": {
        "total": 1,
        "list": [
            {
                "orderNo": 1589034101339,
                "payment": 102980.00,
                "paymentType": 1,
                "paymentTypeDesc": "在线支付",
                "postage": 0,
                "status": 0,
                "statusDesc": "已取消",
                "paymentTime": "",
                "sendTime": "",
                "endTime": null,
                "closeTime": "",
                "createTime": "2020-05-09 22:21:41",
                "orderItemVoList": [
                    {
                        "userId": 1,
                        "orderNo": 1589034101339,
                        "productId": 26,
                        "productName": "Apple iPhone 7 Plus (A1661) 128G 玫瑰金色 移动联通电信4G手机",
                        "productImage": "626dceb4-398e-481b-80e5-4339c3708a6e.jpg",
                        "currentUnitPrice": 6999.00,
                        "quantity": 10,
                        "totalPrice": 69990.00,
                        "createTime": "2020-05-10 11:21:41"
                    },
                    {
                        "userId": 1,
                        "orderNo": 1589034101339,
                        "productId": 27,
                        "productName": "Midea/美的 BCD-535WKZM(E)冰箱双开门对开门风冷无霜智能电家用",
                        "productImage": "626dceb4-398e-481b-80e5-4339c3708a6e.jpg",
                        "currentUnitPrice": 3299.00,
                        "quantity": 10,
                        "totalPrice": 32990.00,
                        "createTime": "2020-05-10 11:21:41"
                    }
                ],
                "shippingVo": {
                    "receiverName": "李登印",
                    "receiverPhone": "18354131190",
                    "receiverMobile": "83582409",
                    "receiverProvince": "山东",
                    "receiverCity": "济南",
                    "receiverDistrict": "章丘区",
                    "receiverAddress": "高管寨1",
                    "receiverZip": "250209"
                },
                "imageHost": "ftp://121.36.145.230/",
                "receiverName": "李登印",
                "shippingId": 37
            }
        ],
        "pageNum": 1,
        "pageSize": 1,
        "size": 1,
        "startRow": 0,
        "endRow": 0,
        "pages": 1,
        "prePage": 0,
        "nextPage": 0,
        "isFirstPage": true,
        "isLastPage": true,
        "hasPreviousPage": false,
        "hasNextPage": false,
        "navigatePages": 8,
        "navigatepageNums": [
            1
        ],
        "navigateFirstPage": 1,
        "navigateLastPage": 1
    }
}
  • 响应失败
{
  "status": 1,
  "msg": "没有找到订单"
}
  1. 订单详情
  • 请求路径: /manage/order/detail.do
  • 请求方法:POST
  • 请求参数:

orderNo

  • 响应成功
{
    "status": 0,
    "data": {
        "orderNo": 1589034101339,
        "payment": 102980.00,
        "paymentType": 1,
        "paymentTypeDesc": "在线支付",
        "postage": 0,
        "status": 0,
        "statusDesc": "已取消",
        "paymentTime": "",
        "sendTime": "",
        "endTime": null,
        "closeTime": "",
        "createTime": "2020-05-09 22:21:41",
        "orderItemVoList": [
            {
                "userId": 1,
                "orderNo": 1589034101339,
                "productId": 26,
                "productName": "Apple iPhone 7 Plus (A1661) 128G 玫瑰金色 移动联通电信4G手机",
                "productImage": "626dceb4-398e-481b-80e5-4339c3708a6e.jpg",
                "currentUnitPrice": 6999.00,
                "quantity": 10,
                "totalPrice": 69990.00,
                "createTime": "2020-05-10 11:21:41"
            },
            {
                "userId": 1,
                "orderNo": 1589034101339,
                "productId": 27,
                "productName": "Midea/美的 BCD-535WKZM(E)冰箱双开门对开门风冷无霜智能电家用",
                "productImage": "626dceb4-398e-481b-80e5-4339c3708a6e.jpg",
                "currentUnitPrice": 3299.00,
                "quantity": 10,
                "totalPrice": 32990.00,
                "createTime": "2020-05-10 11:21:41"
            }
        ],
        "shippingVo": {
            "receiverName": "李登印",
            "receiverPhone": "18354131190",
            "receiverMobile": "83582409",
            "receiverProvince": "山东",
            "receiverCity": "济南",
            "receiverDistrict": "章丘区",
            "receiverAddress": "高管寨1",
            "receiverZip": "250209"
        },
        "imageHost": "ftp://121.36.145.230/",
        "receiverName": "李登印",
        "shippingId": 37
    }
}
  • 响应失败
{
  "status": 1,
  "msg": "没有找到订单"
}
  1. 订单发货
  • 请求路径: /manage/order/send_goods.do
  • 请求方法:POST
  • 请求参数:

orderNo,订单编号

  • 响应成功
{
    "status": 0,
    "msg": "发货成功"
}
  • 响应失败
{
  "status": 1,
  "msg": "发货失败"
}
原创文章 243 获赞 156 访问量 2万+

猜你喜欢

转载自blog.csdn.net/weixin_43404791/article/details/106028906