How to Build a Full‑Stack Logistics Management System with SpringBoot and Layui

This article presents a complete logistics management system case study, covering business requirements, technology stack selection, front‑end and back‑end architecture, core modules such as bill management, receipt handling, vehicle dispatch, and includes full Java code snippets for key operations.

Programmer DD
Programmer DD
Programmer DD
How to Build a Full‑Stack Logistics Management System with SpringBoot and Layui

Project Requirement Description

First, the shipper signs a freight contract with the courier, hands over the goods, and pays according to the contract terms. The courier assigns a vehicle based on the route, signs a transport contract with the driver, and settles freight according to the contract. After the driver verifies the goods, the cargo is loaded and dispatched; any loss after dispatch is the driver’s responsibility.

When the driver reaches the destination, the goods are inspected. If the inspection passes, the driver’s receipt is filled, and the courier notifies both the shipper and the consignee that the goods have arrived. If the inspection fails, an error record is created. If no transshipment is required, the consignee is notified to pick up the goods, and after the consignee’s receipt is filled, the shipper is notified that the goods have been taken.

If transshipment is required, a transshipment information form is filled, the courier notifies both parties that the goods have been transshipped, and after successful transshipment the consignee picks up the goods and the shipper is notified, followed by settlement.

Project Technical Selection

Development Environment

Windows 10 Professional – 1803

Spring Tool Suite 3.9.4.RELEASE

Spring 5 + Spring MVC 5 + Spring Data JPA

MySQL 8.0.11

Architecture Choice

The project adopts a front‑end/back‑end separation to reduce coupling.

Front End

The front end uses Layui 2.3.0, stores pages as HTML, and fetches data from the back end via JavaScript.

Back End

The back end uses SpringBoot 2.0.2 for rapid prototyping, employing the SSH pattern (Spring + Spring MVC + Hibernate).

Key Features

Hibernate is wrapped with SpringBoot‑Data‑JPA to simplify database operations and follows naming conventions for CRUD, eliminating the need for explicit DAO interfaces.

SpringBoot enables fast development by reducing configuration file boilerplate.

Swagger 2.0 automatically scans controller RequestMappings to generate API documentation.

Interface screenshots are provided below.

Functional Module Overview

Bill Management

Bill management handles distribution of bill information and historical bill queries.

Bill Distribution

Bill distribution assigns freight orders to drivers, updates the order and receipt status to “not arrived” and records the shipping time.

Bill Query

Bill query allows retrieval of all historical bills.

The main purpose is to distribute freight orders to drivers and query historical documents.

Receiving Management

Receiving management is performed by staff who fill a freight contract form. Shipper and consignee information are selected from dropdowns that auto‑fetch data from the database; employee ID is auto‑filled from the logged‑in user. Fields such as actual delivery date, validity, and audit status are read‑only and populated automatically by subsequent events. After submission, the contract status becomes “pending shipment” and the bill status becomes “filled”. The system then redirects to add cargo information.

Filling Receiving Form

When filling the receiving form, some fields are auto‑generated from the database. The shipper and consignee are displayed on the front end. After entering origin and destination, the system dynamically generates transshipment points and fees. Adding a freight order automatically generates a code prefixed with “HY”. Upon contract submission, a bill of type “freight order” with status “filled” is created, and the freight order event table status changes to “pending shipment”.
String goodsBillCode = "HY";
while (true) {
    goodsBillCode += randomCode();
    if (goodsBillDao.findByGoodsBillCode(goodsBillCode) == null) {
        break;
    }
}
goodsBill.setGoodsBillCode(goodsBillCode);
goodsBill.setValidity("无效");
goodsBill.setIfAudit("未审核");
goodsBill.setIfSettleAccounts("未结账");
goodsBillDao.save(goodsBill);

BillInfo billInfo = new BillInfo();
billInfo.setBillType("货运单");
billInfo.setBillCode(goodsBillCode);
billInfo.setBillState("已填");
billInfo.setWriteDate(new Date());
billInfoDao.save(billInfo);

GoodsBillEvent goodsBillEvent = new GoodsBillEvent();
goodsBillEvent.setGoodsBillId(goodsBillCode);
goodsBillEvent.setEventName("待发");
goodsBillEvent.setRemark("单据已填");
goodsBillEvent.setOccurTime(new Date());
goodsBillEventDao.save(goodsBillEvent);
After adding cargo, a receipt number prefixed with “HZ” is generated and the freight order status is updated to “valid” and “filled”.
String goodsRevertBillId = "HZ";
while (true) {
    goodsRevertBillId += randomCode();
    if (cargoReceiptDetailDao.findByGoodsRevertBillId(goodsRevertBillId) == null) {
        break;
    }
}
goodsBill.setValidity("有效");
goodsBill.setIfAudit("审核");

Query Receiving Form

The query page lists freight orders by status: pending shipment, not arrived, not settled, and all orders, showing order number, event name, remarks, and timestamp. Only orders in “pending shipment” can be edited or deleted; other statuses are read‑only. All pages allow viewing details by order number.

Newly filled receiving forms are stored with status “pending shipment”.
Details of a freight order can be viewed.
Pending shipment orders can be modified or deleted; deletion only changes order and bill status, not physical removal.
GoodsBillEvent goodsBillEvent = new GoodsBillEvent();
goodsBillEvent.setGoodsBillId(goodsBillCode);
goodsBillEvent.setEventName("删除货运单");
goodsBillEvent.setRemark("顾客不想发货");
goodsBillEvent.setOccurTime(new Date());

BillInfo billInfo = billInfoDao.findByBillCode(goodsBillCode);
billInfo.setBillState("作废");

Vehicle Dispatch Management

The main task is to fill the freight receipt. Users select an unfilled receipt from a dropdown; the system auto‑populates contact and address information. The freight order status becomes “contract not issued”.

Loading location selection provides all possible origins; the system suggests reachable destinations. Dispatch time and driver ID are auto‑filled during bill distribution. Settlement status is updated by the settlement page.

The query page shows contract status: not issued, not arrived, not settled, and all contracts, with pagination displaying receipt number, status, contact, etc. Only contracts in “not issued” can be edited or deleted; all pages allow viewing details by order number.

Filling Transport Contract

Filling a transport contract creates the main receipt record; the back end retrieves contracts without existing transport contracts for the dropdown. After selection, partial information is auto‑filled. The contract starts in “not issued” state, and a receipt bill of type “freight receipt” with status “filled” is added, while the freight order event status changes to “pending shipment”.
BillInfo billInfo = new BillInfo();
billInfo.setBillType("货运回执单");
billInfo.setBillCode(cargoReceipt.getGoodsRevertBillCode());
billInfo.setBillState("已填");
billInfo.setWriteDate(new Date());
billInfoDao.save(billInfo);

Query Transport Contract

Users can query transport contracts by four states: not issued, not arrived, not settled, and all contracts.
Details of contracts in “not issued” can be edited or deleted; deletion only updates order and bill status.
BillInfo billInfo = billInfoDao.findByBillCode(goodsRevertBillCode);
billInfo.setBillState("作废");
billInfo.setWriteDate(new Date());

Arrival Management

Drivers fill arrival receipts; customers fill customer receipts; both can query historical arrivals.

Driver Arrival Receipt

When the driver fills the arrival receipt, the back end updates the freight order and receipt to “not settled”. Customer service can also record pickup and arrival notices.

Customer Arrival Receipt

After the customer fills the arrival receipt, customer service can record the receipt of goods.
Customers can query their own receipt history.

Transshipment Management

Transshipment management handles entry, query, and historical lookup of transshipment company information and cargo transshipment details.

Transshipment Company

Select a city and enter information for transshipment companies in that city.
All transshipment company information can be queried.

Transshipment Information

Enter transshipment details for cargo.
All transshipment records can be queried.

Source Code Access

Click the card below, follow the account, and reply with “物流管理” to obtain the source code.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

databaseLogisticsWeb DevelopmentSpringBoot
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.