An overview,

In the logistics system, the middle office is only responsible for the flow of logistics orders, and the specific fulfillment of logistics often needs to connect with third-party express companies. Since the technical standards of third-party express companies are different, we need to encapsulate the interfaces of third-party express companies. There are two types of encapsulation, one is the encapsulation of sending requests, and the other is the encapsulation of receiving logistics details. For delivery companies, we not only encapsulate the interface level, but abstract out a set of service templates, so that logistics services of express companies are presented to merchants and users in the form of a product. For logistics details, we will design a set of our own data model to connect with different express companies.


2. Logistics services

1. Conceptual model

Logistics service model is divided into three parts: service template, express company model and freight template. Logistics service is divided into three stages from the process: the expression of logistics service, the route of logistics service and the fulfillment of logistics service.



First of all, we will input the express company and configure the freight template of the express company. Then we will edit the service template. Finally, we will mount the express company that can provide the corresponding service to the corresponding service template. After completing the above steps, the businessman can choose the corresponding service for different goods template, mount the service template of goods at the time of user transaction order is can see logistics service, then can let the user to select different Courier company under the service template, and then according to the Courier company freight template for logistics cost calculation, so as to complete the order amount of calculation, When the merchant delivers goods later, the center will call different express companies to deliver goods according to the logistics service snapshot information on the order.


2. Data model

ER data model is shown in the figure below:



2.1, logistics_service
Description: Logistics service template
The field names
The field type
Whether it is null
describe
id
bigint
no
A primary key
service_name
varchar(32)
no
Service Template Name
service_code
varchar(32)
no
Service Template code
type
int
no
Template type
status
int
no
State of the template
is_delete
int
no
Whether to delete the tag
feature
varchar(1024)
is
Extension field
version
int
is
Version number. Default: 0
gmt_created
Datetime
no
Creation time
gmt_modified
Datetime
no
Modify the time
Index fields: ID, Service_CODE


2.2, logistics_company
The field names
The field type
Whether it is null
describe
id
bigint
no
A primary key
company_name
varchar(32)
no
Express Company Name
company_code
varchar(32)
no
Express Company Code
telephone
varchar(32)
is
Company Mobile Phone Number
phone
varchar(32)
is
Company landline number
country
varchar(32)
is
countries
address
varchar(1024)
is
The company address
company_url
varchar(1024)
is
Company Website address
company_logo
varchar(1024)
is
Company logo picture address
status
int
no
state
is_delete
int
no
Whether or not to delete
feature
varchar(1024)
is
Extension field
version
int
is
Version number, default is 0
gmt_created
Datetime
no
Creation time
gmt_modified
Datetime
no
Modify the time
Index fields: ID, company_code


2.3, logistics_service_company
Description: Logistics service template and logistics company association table
The field names
The field type
Whether it can be null
describe
id
bigint
no
A primary key
service_id
bigint
no
Service Template ID
company_id
bigint
no
Logistics Company ID
gmt_created
Datetime
no
Creation time
gmt_modified
Datetime
no
Modify the time
Indexes: ID, service_id, company_id


2.4, freight_template
Description: Freight template
The field names
The field type
Whether it is null
describe
id
bigint
no
A primary key
template_name
varchar(32)
no
Freight template Name
company_id
bigint
no
The company ID
company_code
varchar(32)
no
The company code
template_type
int
no
Template type
is_default
int
no
Whether the default
is_delete
int
no
Whether or not to delete
status
int
no
state
feature
varchar(1024)
is
Extension field
version
int
is
Version number. Default: 0
gmt_created
Datetime
no
Creation time
gmt_modified
Datetime
no
Modify the time
Indexes: ID, company_id, and company_code


2.5, freight_template_detail
Description: Freight template details
The field names
The field type
Whether it is null
describe
id
bigint
no
A primary key
template_id
bigint
no
Freight template ID
sendAreaCode
varchar(32)
no
4 address code of place of shipment
sendAreaName
varchar(64)
is
Name of the fourth address of the place of shipment
sendAreaLevel
int
no
Destination address level 4
receiveAreaCode
varchar(32)
no
4 address code of receiving place
receiveAreaName
varchar(64)
is
4 address name of receiving place
receiveAreaLevel
int
no
Destination address level 4
min_weight
Decimal
is
The weight limit
max_weight
Decimal
is
The weight limit
min_volumn
Decimal
is
The lower volume
max_volumn
Decimal
is
Upper limit of volume
min_count
int
is
The lower number
max_count
int
is
Upper limit of the number
price
Decimal
no
The price
is_default
int
no
Whether the default
is_delete
int
no
Whether or not to delete
status
int
no
state
calculate_type
int
no
Calculation type: 1 Weight 2 volume 3 Quantity
priority
int
no
Priority. Default value: 0
feature
varchar(1024)
is
Extension field
version
int
is
Version number. Default: 0
gmt_created
Datetime
no
Creation time
gmt_modified
Datetime
no
Modify the time
Indexes: ID, template_id, sendAreaCode, receiveAreaCode


3. Logistics details

1. Process design



When the logistics order is delivered, an asynchronous message will be sent. After receiving the message, the logistics details will create a logistics details sheet, and then subscribe to the third-party express company, which will asynchronously send back the logistics details to us. For some express delivery companies that cannot subscribe to logistics details, we check logistics details in batches through scheduled tasks and synchronize them to our database.


2. Data model



2.1, logistics_detail
Description: Logistics details sheet
The field names
The field type
If required
describe
id
bigint
mandatory
A primary key
lg_detail_code
varchar(128)
mandatory
Logistics details no
outer_id
varchar(128)
mandatory
External number
outer_order_type
int
mandatory
External single type: 1 Logistics order
receiver_id
bigint
Not required
The consignee ID
receiver_name
varchar(64)
Not required
Name of consignee
receiver_telephone
varchar(32)
Not required
Consignee’s phone number
receiver_province
varchar(32)
Not required
Province of consignee
receiver_city
varchar(64)
Not required
Consignee city
receiver_area
varchar(64)
Not required
Consignee region
receiver_street
varchar(64)
Not required
Consignee street
receiver_address
varchar(1024)
Not required
Detailed address of consignee
receiver_address_code
varchar(32)
Not required
Four-level address code
sender_id
bigint
Not required
Shipper ID
sender_name
varchar(64)
Not required
Shipper’s name
sender_telephone
varchar(32)
Not required
Shipper’s phone
sender_province
varchar(32)
Not required
Shipper’s province
sender_city
varchar(64)
Not required
Shipper’s city
sender_area
varchar(64)
Not required
Shipper’s area
sender_street
varchar(64)
Not required
Shipper’s street
sender_address
varchar(1024)
Not required
Shipper’s detailed address
sender_address_code
varchar(32)
Not required
Four-level address code
mail_no
varchar(128)
mandatory
The awb
company_code
varchar(32)
Not required
Express Company Code
company_name
varchar(32)
Not required
Express Company Name
service_code
varchar(32)
Not required
Service Template code
status
int
mandatory
state
is_delete
int
mandatory
Whether or not to delete
feature
varchar(1024)
Not required
Extension field
version
int
Not required
Version number. Default: 0
gmt_created
Datetime
mandatory
Creation time
gmt_modified
Datetime
mandatory
Modify the time
Indexes: ID, lg_detail_code, unique(outer_id,outer_order_type)


2.2, logistics_detail_node
The field names
The field type
If required
describe
id
bigint
mandatory
A primary key
lg_detail_code
varchar(128)
mandatory
Logistics details single code
mail_no
varchar(128)
mandatory
The awb
node_time
Datetime
Not required
Logistics details node time
node_detail
varchar(2048)
Not required
Logistics details node content
sort_value
int
Not required
The sorting
feature
varchar(1024)
Not required
Extension field
version
int
Not required
Version number. Default: 0
gmt_created
Datetime
mandatory
Creation time
gmt_modified
Datetime
mandatory
Modify the time
Index: ID, lg_detail_code


Four,

Logistics service and logistics details are a layer of abstraction and encapsulation for third-party express companies, which is relatively simple. In the next article, we will enter the key content: the design of product service layer.


For more articles, visit http://www.apexyun.com/


Contact email: [email protected]

(Please do not reprint without permission)