You are on page 1of 71

Một vài lưu ý và giải thích:

+ Do cơ sở dữ liệu chưa có nhiều dữ liệu và chưa kiểm thử nên khá


hạn chế về mặt số liệu trả về.
+ Các Url có dạng /api/buyer, /api/shop, /api/admin thì phải đăng
nhập và dùng token để sử dụng url đó.
+ Các tài khoản đăng nhập:
Buyer: buyer1, buyer2
Shop: shop1, shop2
Admin: admin01
Mật khẩu là : 1

Contents
Buyer..........................................................................................................................................................3
API: Đăng ký.......................................................................................................................................3
API: Cập nhật thông tin tài khoản......................................................................................................4
API: Đăng nhập bằng gmail google....................................................................................................5
Địa chỉ nhận hàng..................................................................................................................................5
API: Lấy địa chỉ nhận hàng.................................................................................................................6
API: Thêm địa chỉ nhận hàng.............................................................................................................6
API: Sửa địa chỉ nhận hàng................................................................................................................6
API: Xóa địa chỉ nhận hàng................................................................................................................6
Sản phẩm...............................................................................................................................................5
API: Tìm kiếm sản phẩm....................................................................................................................5
API: Xem các mặt hàng - Sản phẩm...................................................................................................5
API: Get các sản phẩm bán chạy - Được xem nhiều nhất (Sẽ hoàn thành sau)................................5
API: Xem chi tiết 1 sản phẩm.............................................................................................................5
Giỏ hàng.................................................................................................................................................5
Thêm sản phẩm vào giỏ hàng, tăng giảm số lượng sản phẩm trong giỏ (cần đăng nhập buyer).....5
Lấy thông tin giỏ hàng(cần đăng nhập buyer)...................................................................................5
Xóa sản phẩm khỏi giỏ (cần đăng nhập buyer).................................................................................5
Đếm số lượng sản phẩm trong giỏ(cần đăng nhập buyer)................................................................5
Tính tiền của một hoặc nhiều sản phẩm trong giỏ (chưa hoàn thành).............................................6
Tạo đơn hàng.........................................................................................................................................6
Tạo đơn hàng (cần đăng nhập buyer)................................................................................................6
Admin - Không giới hạn..............................................................................................................................6
Create ProductCategory (Yêu cầu đăng nhập Admin).......................................................................6
Edit ProductCategory (Yêu cầu đăng nhập Admin)..........................................................................6
Delete ProductCategory (Yêu cầu đăng nhập Admin)......................................................................6
API: Đăng ký.......................................................................................................................................6
API: Cập nhật thông tin tài khoản......................................................................................................7
API: Tìm kiếm sản phẩm....................................................................................................................7
API: Xem 1 sản phẩm.........................................................................................................................7
API: Ẩn các sản phẩm.........................................................................................................................7
API: Xóa các sản phẩm - Chỉ là ẩn sản phẩm đi (HIDDEN).................................................................7
API: Thống kê.....................................................................................................................................7
ProductType...........................................................................................................................................8
Create ProductType (Yêu cầu đăng nhập Admin).............................................................................9
Get All ProductType (Yêu cầu đăng nhập Admin)...........................................................................9
Edit ProductType (Yêu cầu đăng nhập Admin)..................................................................................9
Xóa Product Type...............................................................................................................................9
Voucher..................................................................................................................................................8
Tạo Voucher của Shopee (Yêu cầu Admin)........................................................................................8
Sửa voucher của Shopee (Yêu cầu Admin)........................................................................................8
Xóa voucher của Shopee (yêu cầu Admin)........................................................................................8
Xem tất cả Voucher của Shopee dưới quyền Admin (Yêu cầu đăng nhập Admin)...........................8
Tỉnh thành..............................................................................................................................................9
API: Lấy một tỉnh thành bằng code.................................................................................................10
API Thêm một tỉnh thành mới.........................................................................................................10
API: Sửa thông tin một tỉnh thành...................................................................................................10
API: Xóa 1 tỉnh thành.......................................................................................................................10
Shop.........................................................................................................................................................10
API: Đăng ký.....................................................................................................................................10
API: Cập nhật thông tin tài khoản....................................................................................................10
Báo cáo thống kê.................................................................................................................................10
API: Lấy doanh thu và số lượng sản phẩm bán được......................................................................10
API: Thống kê...................................................................................................................................10
Shop Category......................................................................................................................................11
Create ShopCategory (Yêu cầu đăng nhập Shop)............................................................................11
Get ShopCategories By Shop (Yêu cầu đăng nhập Shop)................................................................11
Edit ShopCategory (Yêu cầu đăng nhập Shop)................................................................................11
Delete ShopCategory (Yêu cầu đăng nhập Shop)............................................................................11
Shop order...........................................................................................................................................11
Get All ShopOrder (Yêu cầu đăng nhập Shop).................................................................................11
Get ShopOrders By Status (Yêu cầu đăng nhập Shop)....................................................................11
Get ShopOrder By Id (Yêu cầu đăng nhập Shop).............................................................................12
ExportData (Yêu cầu đăng nhập Shop)............................................................................................12
ExportData By Status (Yêu cầu đăng nhập Shop)............................................................................12
Voucher................................................................................................................................................13
Sửa voucher của Shop (yêu cầu đăng nhập Shop)..........................................................................13
Xóa Voucher của Shop (yêu cầu đăng nhập Shop)..........................................................................13
Xem tất cả voucher của Shop dưới quyền Shop (Yêu cầu đăng nhập Shop)..................................13
Dùng chung ( không cần đăng nhập hoặc giống nhau về cách dùng).....................................................15
API: Đăng nhập................................................................................................................................15
Lấy token xác thực quên mật khẩu, token sẽ được gửi về mail đã cung cấp (Không yêu cầu đăng
nhập với url này – không gán header Authorization)......................................................................15
Reset mật khẩu với token nhận qua email và mật khẩu mới (Yêu cầu đã đăng nhập – có header
Authorization)..................................................................................................................................15
Gửi mã token xác thực email...........................................................................................................15
Xác thực email với token nhận được qua email..............................................................................15
Lấy thông tin tài khoản đang đăng nhập.........................................................................................16
API: Cập nhật mật khẩu...................................................................................................................16
Get ProductTypes Active (System)..................................................................................................16
Get ProductType By Id.....................................................................................................................16
Get All ProductCategory..................................................................................................................17
Get ProductCategory By Id..............................................................................................................20
Get ShopCategory By Id...................................................................................................................20
Get ShopCategory By Name............................................................................................................20
Xem tất cả Voucher..........................................................................................................................21
Xem tất cả Voucher của một shop nào đó......................................................................................21
Xem tất cả Voucher của Shopee......................................................................................................21
Xem thông tin của một voucher......................................................................................................21
API: lấy danh sách các tỉnh thành hỗ trợ.........................................................................................22

Buyer

API: Đăng ký

http://localhost:8081/api/buyer/signup
API: Cập nhật thông tin tài khoản

API: Đăng nhập bằng gmail google

Url nhập trên chrome: http://localhost:8081/oauth2/authorization/google


Dùng gmail để đăng nhập. Sau khi đăng nhập thành công sẽ redirect về url
http://localhost:3000//login/google?
token=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJidXllckBCaW5oIEhvw6BuZyBWxINuIiwiaWF0IjoxNjU5MzY1
MTc3LCJleHAiOjE2NTk0NTE1Nzd9.3duijGL9SQsOp1_Y2X1Qgnq46GnpBGEOwvdt3RfmEXXWeEzTDaTp
zac2EVHIqEg4_fwzzX8WZGijZcWc69Pu2w
Với phần token dùng cho role - buyer.
Có thể đăng nhập với user name là phần trước @ trong gmail và mật khẩu mặc định là 1.
Note: Sẽ nâng cấp lại mật khẩu cho phù hợp sau.
Địa chỉ nhận hàng

API: Lấy địa chỉ nhận hàng

Url: GET http://localhost:8081/api/buyer/delivery-address

Đăng nhập bằng tài khoản buyer và lấy token bỏ vào header

Result:

{
    "success": true,
    "message": null,
    "page": 0,
    "totalPage": 0,
    "datas": [
        {
            "id": 1,
            "id_buyer": 1,
            "address": "HCM",
            "city": "TP HCM",
            "state": null,
            "country": "VN"
        }
    ],
    "data": null
}

API: Thêm địa chỉ nhận hàng

Url: POST http://localhost:8081/api/buyer/delivery-address

Body:

{
            "address": "114/312",
            "city": "Di An",
            "state": "Binh Duong",
            "country": "Viet nam"
}
Reuslt:

{
    "success": true,
    "message": "Thêm mới địa chỉ thành công !",
    "page": 0,
    "totalPage": 0,
    "datas": [],
    "data": {
        "id": null,
        "id_buyer": 2,
        "address": "114/312",
        "city": "Di An",
        "state": "Binh Duong",
        "country": "Viet nam"
    }
}

API: Sửa địa chỉ nhận hàng

Url: PUT http://localhost:8081/api/buyer/delivery-address/2

Body
{
            "address": "114/31",
            "city": "Di An",
            "state": "Binh Duong",
            "country": "Viet nam"
}
Result:
{
    "success": true,
    "message": "Cập nhật địa chỉ nhận hàng thành công !",
    "page": 0,
    "totalPage": 0,
    "datas": [],
    "data": {
        "id": 2,
        "id_buyer": 2,
        "address": "114/31",
        "city": "Di An",
        "state": "Binh Duong",
        "country": "Viet nam"
    }
}
API: Xóa địa chỉ nhận hàng

Url: DELETE http://localhost:8081/api/buyer/delivery-address

Body: Danh sách id

["6"]

Result:

{
    "success": true,
    "message": "Delete Successfully !"
}

Sản phẩm

API: Tìm kiếm sản phẩm

Url: GET

http://localhost:8081/api/search?keyword=o&locations=dong-
nai&category=5&max_price=170000&min_price=17000&ratingFilter=2&newProduct=true&page=1&li
mit=3&type=1&sortBy=2
(Có thể bỏ bớt param nếu muốn vẫn hoạt động).
Result:

{
    "success": true,
    "message": "",
    "currentPage": 0,
    "totalPage": 1,
    "data": [
        {
            "id": 20,
            "createdDate": 1658066846565,
            "modifiedDate": 1658066846565,
            "createdBy": "anonymousUser",
            "modifiedBy": "anonymousUser",
            "idType": 1,
            "idCategory": 5,
            "idShop": 2,
            "idShopCategory": null,
            "idSellPlace": 3,
            "sellPlace": "Đồng Nai",
            "name": "Product 20",
            "avatar": "4234",
            "description": "Des Des",
            "price": 20000,
            "sale": 0,
            "view": 2,
            "discount": 0.0,
            "discountStart": 1660731691813,
            "discountEnd": 1658053291813,
            "averageRating": 2.1,
            "status": "ACTIVE",
            "reviewCount": 0,
            "isNew": true,
            "images": [],
            "classifications": []
        },
        {
            "id": 21,
            "createdDate": 1658073274591,
            "modifiedDate": 1658073274591,
            "createdBy": "anonymousUser",
            "modifiedBy": "anonymousUser",
            "idType": 1,
            "idCategory": 5,
            "idShop": 2,
            "idShopCategory": null,
            "idSellPlace": 3,
            "sellPlace": "Đồng Nai",
            "name": "Product FN",
            "avatar": "dsgfasg",
            "description": "Des Des",
            "price": 20000,
            "sale": 0,
            "view": 1,
            "discount": 0.0,
            "discountStart": 1660731691813,
            "discountEnd": 1658053291813,
            "averageRating": 2.0,
            "status": "ACTIVE",
            "reviewCount": 0,
            "isNew": true,
            "images": [],
            "classifications": []
        },
        {
            "id": 18,
            "createdDate": 1658066491181,
            "modifiedDate": 1658066491181,
            "createdBy": "anonymousUser",
            "modifiedBy": "anonymousUser",
            "idType": 1,
            "idCategory": 5,
            "idShop": 2,
            "idShopCategory": null,
            "idSellPlace": 3,
            "sellPlace": "Đồng Nai",
            "name": "Product 18",
            "avatar": "dsgfasg",
            "description": "Des Des",
            "price": 18000,
            "sale": 0,
            "view": 5,
            "discount": 0.0,
            "discountStart": 1660731691813,
            "discountEnd": 1658053291813,
            "averageRating": 4.5,
            "status": "ACTIVE",
            "reviewCount": 0,
            "isNew": true,
            "images": [],
            "classifications": []
        }
    ]
}
API: Xem các mặt hàng - Sản phẩm

Url: GET http://localhost:8081/api/product?

idShop=1&idCategory=5&idType=1&idSellPlace=3&isNew=tr
ue&page=1&size=3&sortBy=2&sortDescending=false

(Có thể thêm bớt param tùy ý ví dụ muốn tìm theo Category thì chỉ cần để 1 mình category.)

Result:

{
    "success": true,
    "message": "",
    "currentPage": 0,
    "totalPage": 1,
    "data": [
        {
            "id": 11,
            "createdDate": 1658053137574,
            "modifiedDate": 1658053137574,
            "createdBy": "anonymousUser",
            "modifiedBy": "anonymousUser",
            "idType": 1,
            "idCategory": 5,
            "idShop": 1,
            "idShopCategory": null,
            "idSellPlace": 3,
            "sellPlace": "Đồng Nai",
            "name": "Product 3",
            "avatar": "ádf",
            "description": "Des Des",
            "price": 3000,
            "sale": 0,
            "view": 14,
            "discount": 0.0,
            "discountStart": 1660731691813,
            "discountEnd": 1658053291813,
            "averageRating": 3.5,
            "status": "ACTIVE",
            "reviewCount": 0,
            "isNew": true,
            "images": [],
            "classifications": []
        },
        {
            "id": 12,
            "createdDate": 1658053291813,
            "modifiedDate": 1658053291813,
            "createdBy": "anonymousUser",
            "modifiedBy": "anonymousUser",
            "idType": 1,
            "idCategory": 5,
            "idShop": 1,
            "idShopCategory": null,
            "idSellPlace": 3,
            "sellPlace": "Đồng Nai",
            "name": "Product 3",
            "avatar": "ádf",
            "description": "Des Des",
            "price": 3000,
            "sale": 0,
            "view": 1,
            "discount": 0.0,
            "discountStart": 1660731691813,
            "discountEnd": 1658053291813,
            "averageRating": 3.5,
            "status": "ACTIVE",
            "reviewCount": 0,
            "isNew": true,
            "images": [],
            "classifications": [
                {
                    "id": 1,
                    "idProduct": 12,
                    "variationName": null,
                    "price": 15000,
                    "quantity": 10
                }
            ]
        },
        {
            "id": 14,
            "createdDate": 1658054063192,
            "modifiedDate": 1658054063192,
            "createdBy": "anonymousUser",
            "modifiedBy": "anonymousUser",
            "idType": 1,
            "idCategory": 5,
            "idShop": 1,
            "idShopCategory": null,
            "idSellPlace": 3,
            "sellPlace": "Đồng Nai",
            "name": "Product 3",
            "avatar": "dsafa",
            "description": "Des Des",
            "price": 3000,
            "sale": 0,
            "view": 0,
            "discount": 0.0,
            "discountStart": 1660731691813,
            "discountEnd": 1658053291813,
            "averageRating": 4.5,
            "status": "ACTIVE",
            "reviewCount": 0,
            "isNew": true,
            "images": [],
            "classifications": [
                {
                    "id": 3,
                    "idProduct": 14,
                    "variationName": null,
                    "price": 25000,
                    "quantity": 25
                }
            ]
        }
    ]
}

API: Get các sản phẩm bán chạy - Được xem nhiều nhất (Sẽ
hoàn thành sau)

API: Xem chi tiết 1 sản phẩm

Url: GET http://localhost:8081/api/product/18

Result:

{
    "success": true,
    "message": "",
    "data": {
        "id": 18,
        "createdDate": 1658066491181,
        "modifiedDate": 1658066491181,
        "createdBy": "anonymousUser",
        "modifiedBy": "anonymousUser",
        "idType": 1,
        "idCategory": 5,
        "idShop": 2,
        "idShopCategory": null,
        "idSellPlace": 3,
        "sellPlace": "Đồng Nai",
        "name": "Product 18",
        "avatar": "dsgfasg",
        "description": "Des Des",
        "price": 18000,
        "sale": 0,
        "view": 6,
        "discount": 0.0,
        "discountStart": 1660731691813,
        "discountEnd": 1658053291813,
        "averageRating": 4.5,
        "status": "ACTIVE",
        "reviewCount": 0,
        "isNew": true,
        "images": [],
        "classifications": []
}

Giỏ hàng

Thêm sản phẩm vào giỏ hàng, tăng giảm số lượng sản phẩm
trong giỏ (cần đăng nhập buyer)

POST http://localhost:8081/api/buyer/cart
{
    "idProductClassification": 1,
    "quantity": 2
}

Lấy thông tin giỏ hàng(cần đăng nhập buyer)

GET http://localhost:8081/api/buyer/cart
Xóa sản phẩm khỏi giỏ (cần đăng nhập buyer)

DELETE http://localhost:8081/api/buyer/cart
[1, 2] ( danh sách các id product classification)

Đếm số lượng sản phẩm trong giỏ(cần đăng nhập buyer)

GET http://localhost:8081/api/buyer/cart/count

Tính tiền của một hoặc nhiều sản phẩm trong giỏ (chưa hoàn
thành)
Tạo đơn hàng

Tạo đơn hàng (cần đăng nhập buyer)

POST http://localhost:8081/api/buyer/order

Request body:
{
    "shopOrderItems": [
        {
            "idShop": 1,
            "idProductClassifications": [
                1,
                2
            ],
            "couponCode": "SHOPCODE1",
            "priceOriginal": 100000,
            "shipPrice": 10000,
            "platformPriceOff": 5000,
            "shipPriceOff": 3000,
            "shopPriceOff": 4000,
            "buyerNote": "giao nhanh nghe chưa"

        }, {
            "idShop": 2,
            "idProductClassifications": [
                3
            ],
            "couponCode": "SHOPCODE2",
            "priceOriginal": 100000,
            "shipPrice": 10000,
            "platformPriceOff": 5000,
            "shipPriceOff": 7000,
            "shopPriceOff": 4000,
            "buyerNote": "giao nhanh nghe chưa"

        }
    ],
    "idPaymentMethod": null,
    "idAddress": 1,
    "priceOriginal": 100000,
    "shipPrice": 10000,
    "shipPriceOff": 5000,
    "platformPriceOff": 30000,
    "platformCoupon": "CODE2",
    "freeshipCoupon": "CODE1"
}
Admin - Không giới hạn

Create ProductCategory (Yêu cầu đăng nhập Admin)

URL: localhost:8081/api/admin/productcategory
Edit ProductCategory (Yêu cầu đăng nhập Admin)

URL: localhost:8081/api/admin/productcategory/18
Delete ProductCategory (Yêu cầu đăng nhập Admin)

URL: localhost:8081/api/admin/productcategory/19
API: Đăng ký

http://localhost:8081/api/admin/signup

API: Cập nhật thông tin tài khoản


API: Tìm kiếm sản phẩm

Url: GET

http://localhost:8081/api/admin/manage/product?
searchName=o&idShop=1&idCategory=5&idType=1&idSellPlace=3&newProduct=true&page=1&size
=3&sortBy=2&status=ACTIVE

Result:

{
    "success": true,
    "message": "",
    "currentPage": 0,
    "totalPage": 1,
    "data": [
        {
            "id": 11,
            "createdDate": 1658053137574,
            "modifiedDate": 1658053137574,
            "createdBy": "anonymousUser",
            "modifiedBy": "anonymousUser",
            "idType": 1,
            "idCategory": 5,
            "idShop": 1,
            "idShopCategory": null,
            "idSellPlace": 3,
            "sellPlace": "Đồng Nai",
            "name": "Product 3",
            "avatar": "ádf",
            "description": "Des Des",
            "price": 3000,
            "sale": 0,
            "view": 14,
            "discount": 0.0,
            "discountStart": 1660731691813,
            "discountEnd": 1658053291813,
            "averageRating": 3.5,
            "status": "ACTIVE",
            "reviewCount": 0,
            "isNew": true,
            "images": [],
            "classifications": []
        },
        {
            "id": 12,
            "createdDate": 1658053291813,
            "modifiedDate": 1658053291813,
            "createdBy": "anonymousUser",
            "modifiedBy": "anonymousUser",
            "idType": 1,
            "idCategory": 5,
            "idShop": 1,
            "idShopCategory": null,
            "idSellPlace": 3,
            "sellPlace": "Đồng Nai",
            "name": "Product 3",
            "avatar": "ádf",
            "description": "Des Des",
            "price": 4000,
            "sale": 0,
            "view": 1,
            "discount": 0.0,
            "discountStart": 1660731691813,
            "discountEnd": 1658053291813,
            "averageRating": 3.5,
            "status": "ACTIVE",
            "reviewCount": 0,
            "isNew": true,
            "images": [],
            "classifications": [
                {
                    "id": 1,
                    "idProduct": 12,
                    "variationName": null,
                    "price": 15000,
                    "quantity": 10
                }
            ]
        },
        {
            "id": 14,
            "createdDate": 1658054063192,
            "modifiedDate": 1658054063192,
            "createdBy": "anonymousUser",
            "modifiedBy": "anonymousUser",
            "idType": 1,
            "idCategory": 5,
            "idShop": 1,
            "idShopCategory": null,
            "idSellPlace": 3,
            "sellPlace": "Đồng Nai",
            "name": "Product 3",
            "avatar": "dsafa",
            "description": "Des Des",
            "price": 3000,
            "sale": 0,
            "view": 0,
            "discount": 0.0,
            "discountStart": 1660731691813,
            "discountEnd": 1658053291813,
            "averageRating": 4.5,
            "status": "ACTIVE",
            "reviewCount": 0,
            "isNew": true,
            "images": [],
            "classifications": [
                {
                    "id": 3,
                    "idProduct": 14,
                    "variationName": null,
                    "price": 25000,
                    "quantity": 25
                }
            ]
        }
    ]
}

API: Xem 1 sản phẩm

Url: GET http://localhost:8081/api/admin/manage/product/12

Result:

{
    "success": true,
    "message": "",
    "data": {
        "id": 12,
        "createdDate": 1658053291813,
        "modifiedDate": 1658053291813,
        "createdBy": "anonymousUser",
        "modifiedBy": "anonymousUser",
        "idType": 1,
        "idCategory": 5,
        "idShop": 1,
        "idShopCategory": null,
        "idSellPlace": 3,
        "sellPlace": "Đồng Nai",
        "name": "Product 3",
        "avatar": "ádf",
        "description": "Des Des",
        "price": 4000,
        "sale": 0,
        "view": 1,
        "discount": 0.0,
        "discountStart": 1660731691813,
        "discountEnd": 1658053291813,
        "averageRating": 3.5,
        "status": "ACTIVE",
        "reviewCount": 0,
        "isNew": true,
        "images": [],
        "classifications": [
            {
                "id": 1,
                "idProduct": 12,
                "variationName": null,
                "price": 15000,
                "quantity": 10
            }
        ]
    }
}

API: Khóa các sản phẩm


Url: PUT http://localhost:8081/api/admin/manage/product/ban
Body:
["11", "14"]

Result:
{
    "success": true,
    "message": "Thao tác thành công !",
    "data": null
}
Note: Bấm 1 lần là khóa, Bấm lần nửa là hủy khóa chuyển sang ẩn.
API: Ẩn các sản phẩm

Note: Nhấn 1 lần là ẩn, Nhấn lần nửa là hiện. Có thể kiểm tra sản phẩm bằng tìm kiếm Ví dụ:
Status = {ACTIVE, HIDDEN, BANNED}

Url: GET http://localhost:8081/api/admin/manage/product?

status=HIDDEN

Result:

{
    "success": true,
    "message": "",
    "currentPage": 0,
    "totalPage": 0,
    "data": [
        {
            "id": 11,
            "createdDate": 1658053137574,
            "modifiedDate": 1659365629077,
            "createdBy": "anonymousUser",
            "modifiedBy": "admin01",
            "idType": 1,
            "idCategory": 5,
            "idShop": 1,
            "idShopCategory": null,
            "idSellPlace": 3,
            "sellPlace": "Đồng Nai",
            "name": "Product 3",
            "avatar": "ádf",
            "description": "Des Des",
            "price": 3000,
            "sale": 0,
            "view": 14,
            "discount": 0.0,
            "discountStart": 1660731691813,
            "discountEnd": 1658053291813,
            "averageRating": 3.5,
            "status": "HIDDEN",
            "reviewCount": 0,
            "isNew": true,
            "images": [],
            "classifications": []
        },
        {
            "id": 14,
            "createdDate": 1658054063192,
            "modifiedDate": 1659365629078,
            "createdBy": "anonymousUser",
            "modifiedBy": "admin01",
            "idType": 1,
            "idCategory": 5,
            "idShop": 1,
            "idShopCategory": null,
            "idSellPlace": 3,
            "sellPlace": "Đồng Nai",
            "name": "Product 3",
            "avatar": "dsafa",
            "description": "Des Des",
            "price": 3000,
            "sale": 0,
            "view": 0,
            "discount": 0.0,
            "discountStart": 1660731691813,
            "discountEnd": 1658053291813,
            "averageRating": 4.5,
            "status": "HIDDEN",
            "reviewCount": 0,
            "isNew": true,
            "images": [],
            "classifications": [
                {
                    "id": 3,
                    "idProduct": 14,
                    "variationName": null,
                    "price": 25000,
                    "quantity": 25
                }
            ]
        }
    ]
}
Body:
["11","14"]
Result:
{
    "success": true,
    "message": "Thao tác thành công !",
    "data": null
}

API: Xóa các sản phẩm - Chỉ là ẩn sản phẩm đi (HIDDEN)

Url: DELETE http://localhost:8081/api/admin/manage/product


API: Thống kê

Url: GET http://localhost:8081/api/admin?dStart=2022-07-

10&dEnd=2022-07-20&dLast=15

(Có thể bỏ các param nếu muốn, để phù hợp với nhu cầu)
Ví dụ muốn thống kê theo tháng 7 thì lấy dStart là ngày 1 và dEnd là 30.
Hệ thống ưu tiên dLast. Nếu có dLast thì sẽ tự động chuyển dEnd là ngày hôm nay và dStart là n ngày
trước, dùng để thống kê n ngày trước đó.

Result:

{
    "success": true,
    "messsage": "",
    "dataHolder": [
        {
            "value": 1,
            "status": "WAIT_FOR_CONFIRMATION"
        },
        {
            "value": 1,
            "status": "WAIT_FOR_SENDING"
        }
    ],
    "adminDataHolder": {
        "sale_total_shop": 190000,
        "sale_total_shopee": 110000,
        "total_ship_amount": 20000,
        "shopee_price_off": 100000
    },
    "working_voucher": 2,
    "sale_amount": 9
}

ProductType

Create ProductType (Yêu cầu đăng nhập Admin)

URL: localhost:8081/api/admin/producttype
Get All ProductType (Yêu cầu đăng nhập Admin)

URL: localhost:8081/api/admin/producttype
Edit ProductType (Yêu cầu đăng nhập Admin)

URL: localhost:8081/api/admin/producttype/6
Xóa Product Type

URL: localhost:8081/api/admin/producttype/5

Voucher

Tạo Voucher của Shopee (Yêu cầu Admin)

http://localhost:8081/api/admin/coupon_code/insert
Sửa voucher của Shopee (Yêu cầu Admin)

http://localhost:8081/api/admin/coupon_code/1
Xóa voucher của Shopee (yêu cầu Admin)

http://localhost:8081/api/admin/coupon_code/4

Xem tất cả Voucher của Shopee dưới quyền Admin (Yêu cầu
đăng nhập Admin)

http://localhost:8081/api/admin/coupon_code
Tỉnh thành

API: Lấy một tỉnh thành bằng code

Url: GET http://localhost:8081/api/sell-place/ho-chi-minh

Result:

{
    "success": true,
    "message": null,
    "page": 0,
    "totalPage": 0,
    "datas": [],
    "data": {
        "id": 1,
        "createdDate": null,
        "modifiedDate": null,
        "createdBy": null,
        "modifiedBy": null,
        "code": "ho-chi-minh",
        "name": "TP Hồ Chí Minh"
    }
}

API Thêm một tỉnh thành mới

Url: POST http://localhost:8081/api/admin/sell-place

Request body:

{
    "name": "Lạng Sơn",
    "code": "lang-son"
}

Header kèm token đăng nhập = admin


Result:

{
    "success": true,
    "message": "Thêm mới tỉnh thành thành công !",
    "page": 0,
    "totalPage": 0,
    "datas": [],
    "data": {
        "id": 23,
        "createdDate": 1659361167764,
        "modifiedDate": 1659361167764,
        "createdBy": "admin01",
        "modifiedBy": "admin01",
        "code": "lang-son",
        "name": "Lạng Sơn"
    }
}

API: Sửa thông tin một tỉnh thành

Url: PUT http://localhost:8081/api/admin/sell-place/23

Request body:

{
    "name": "Lạng Sơn",
    "code": "lang-son"
}

Header: như POST

Result:

{
    "success": true,
    "message": "Cập nhật tỉnh thành thành công !",
    "page": 0,
    "totalPage": 0,
    "datas": [],
    "data": {
        "id": 23,
        "createdDate": 1659361167764,
        "modifiedDate": 1659361326213,
        "createdBy": "admin01",
        "modifiedBy": "admin01",
        "code": "lang-son",
        "name": "Lạng Sơn 01"
    }
}

API: Xóa 1 tỉnh thành

Url: DELETE http://localhost:8081/api/admin/sell-place

Header như trên.

Body:

["21", "22"]

Result:

{
    "success": false,
    "message": "Vui lòng kiểm tra lại các tỉnh thành muốn xóa !",
    "page": 0,
    "totalPage": 0,
    "datas": [],
    "data": null
}

Vì không có tỉnh thành mã 21, 22 trong database.

Shop

API: Đăng ký

http://localhost:8081/api/shop/signup
API: Cập nhật thông tin tài khoản
Báo cáo thống kê

API: Lấy doanh thu và số lượng sản phẩm bán được

Url: GET http://localhost:8081/api/shop/sales?dStart=2022-01-


11&dEnd=2022-08-18&dLast=20

Result:

{
    "success": true,
    "message": "",
    "data": {
        "sales": 2,
        "salesValue": 95000
    }
}

API: Thống kê

Url: GET http://localhost:8081/api/shop

Result:

{
    "success": true,
    "message": null,
    "countAccessTimesShop": 19,
    "countOrderConfirmed": 1,
    "workPerformance": {
        "bannedProduct": 0,
        "canceled_order_rate": 0.0,
        "rating": 0.0,
        "avg_time_prepare": 0.42
    },
    "pcancelled": 0,
    "pdelivered": 0,
    "pdelivering": 0,
    "poutOfStock": 0,
    "pwait_FOR_SENDING": 1,
    "pwait_FOR_CONFIRMATION": 0
}

Shop Category

Create ShopCategory (Yêu cầu đăng nhập Shop)

URL: localhost:8081/api/shop/shopcategory
Get ShopCategories By Shop (Yêu cầu đăng nhập Shop)

URL: localhost:8081/api/shop/shopcategory
URL: localhost:8081/api/shop/shopcategory?searchName=muc
Edit ShopCategory (Yêu cầu đăng nhập Shop)

URL: localhost:8081/api/shop/shopcategory/11
Delete ShopCategory (Yêu cầu đăng nhập Shop)

URL: localhost:8081/api/shop/shopcategory/11

Shop order

Get All ShopOrder (Yêu cầu đăng nhập Shop)

URL: localhost:8081/api/shop/shoporder
Get ShopOrders By Status (Yêu cầu đăng nhập Shop)

URL: localhost:8081/api/shop/shoporder/status=WAIT_FOR_CONFIRMATION
Status: WAIT_FOR_CONFIRMATION,WAIT_FOR_SENDING,DELIVERING,DELIVERED, CANCELLED
Get ShopOrder By Id (Yêu cầu đăng nhập Shop)

URL: localhost:8081/api/shop/shoporder/id=1
ExportData (Yêu cầu đăng nhập Shop)

URL: localhost:8081/api/shop/shoporder/export
Cần đăng nhập account Shop trên trình duyệt rồi truy cập vào URL mới hiện file download
ExportData By Status (Yêu cầu đăng nhập Shop)

URL: localhost:8081/api/shop/shoporder/export/status=WAIT_FOR_CONFIRMATION

Voucher

Tạo Voucher của Shop (Yêu cầu đăng nhập Shop)


Sửa voucher của Shop (yêu cầu đăng nhập Shop)

http://localhost:8081/api/shop/coupon_code/edit/3
Xóa Voucher của Shop (yêu cầu đăng nhập Shop)

http://localhost:8081/api/shop/coupon_code/6
Xem tất cả voucher của Shop dưới quyền Shop (Yêu cầu đăng
nhập Shop)

http://localhost:8081/api/shop/coupon_code
Dùng chung ( không cần đăng nhập hoặc
giống nhau về cách dùng)

API: Đăng nhập

http://localhost:8081/api/admin/login

Tương tự shop, buyer.


Sau đó dùng token để xác thực các API liên quan.
Lấy token xác thực quên mật khẩu, token sẽ được gửi về mail
đã cung cấp (Không yêu cầu đăng nhập với url này – không
gán header Authorization).

Tương tự shop, buyer.

Reset mật khẩu với token nhận qua email và mật khẩu mới
(Yêu cầu đã đăng nhập – có header Authorization)
Gửi mã token xác thực email.

Tương tự shop, buyer.

Xác thực email với token nhận được qua email.

Tương tự shop, buyer.

Lấy thông tin tài khoản đang đăng nhập

Tương tự shop, buyer.


API: Cập nhật mật khẩu

Tương tự với buyer, shop.

Get ProductTypes Active (System)

URL: localhost:8081/api/producttype
URL: localhost:8081/api/producttype?searchName=API
Get ProductType By Id

URL: localhost:8081/api/producttype/6

Get All ProductCategory

URL: localhost:8081/api/productcategory
URL: localhost:8081/api/productcategory?searchName=api
Get ProductCategory By Id

URL: localhost:8081/api/productcategory/17

Get ShopCategory By Id

URL: localhost:8081/api/shopcategory/10
Get ShopCategory By Name

URL: localhost:8081/api/shopcategory?searchName=35

Xem tất cả Voucher

http://localhost:8081/api/coupon_code
Xem tất cả Voucher của một shop nào đó

http://localhost:8081/api/coupon_code/shop/1
Xem tất cả Voucher của Shopee

http://localhost:8081/api/coupon_code/shopee
Xem thông tin của một voucher

http://localhost:8081/api/coupon_code/4
API: lấy danh sách các tỉnh thành hỗ trợ.

Url: GET http://localhost:8081/api/sell-place

Result:

{
    "success": true,
    "message": null,
    "page": 0,
    "totalPage": 0,
    "datas": [
        {
            "id": 1,
            "createdDate": null,
            "modifiedDate": null,
            "createdBy": null,
            "modifiedBy": null,
            "code": "ho-chi-minh",
            "name": "TP Hồ Chí Minh"
        },
        {
            "id": 2,
            "createdDate": null,
            "modifiedDate": null,
            "createdBy": null,
            "modifiedBy": null,
            "code": "binh-duong",
            "name": "Bình Dương"
        }
],
    "data": null
}

You might also like