order system

order system

 

There is a checkout button on the shopping cart page , click the button to jump to the confirmation order page.

 

Select the product to be purchased in the shopping cart, and click the checkout button (the parameters passed in are the product id and the number of products num )

 

Business logic:

 

Determine if the user is logged in

Interceptor:

1.  Get the token from the cookie

2.  If the token is empty, it means that the user is not logged in and needs to jump to the login page to log in. When redirecting to the login page, pass the url of the current system as a parameter, so that you can jump to the current system after the login is successful.

3.  If the token is not empty, call the service in the single sign-on system and verify whether the user information exists according to the token

If it does not exist, it means that the user login has expired, and you need to jump to the login page to log in again. When redirecting to the login page, pass the url of the current system as a parameter, so that you can jump to the current system after the login is successful.

If it exists, it means that the user has logged in, and the current user information is stored in the request and passed to the Controller .

 

Controller

1. Obtain user information

2. Query the user's harvest address list according to the user id (using static data)

3. According to the product id , go to the database to find out the list of products to be purchased

4. Pass the address list and product list to jsp

5. Return to the confirmation order page

 

When you confirm that the order information is correct, click the Submit Order button. (The page will pass a lot of parameter information, and the server uses the packaged pojo to receive it)

 

To submit an order is to insert records into the order table order , order item table order_item , and order logistics table order_shipping respectively in the database. (The order table and the order item table are a one-to-many relationship, and the order table and the order logistics table are a one-to-one relationship)

 

Business logic:

 

Determine if the user is logged in

Interceptor:

1.  Get the token from the cookie

2.  If the token is empty, it means that the user is not logged in and needs to jump to the login page to log in. When redirecting to the login page, pass the url of the current system as a parameter, so that you can jump to the current system after the login is successful.

3.  If the token is not empty, call the service in the single sign-on system and verify whether the user information exists according to the token

If it does not exist, it means that the user login has expired, and you need to jump to the login page to log in again. When redirecting to the login page, pass the url of the current system as a parameter, so that you can jump to the current system after the login is successful.

If it exists, it means that the user has logged in, and the current user information is stored in the request and passed to the Controller .

 

Controller:

1. Obtain user information

2. Generate the order number ( use the incr command of redis to generate the order number and assign the initial value)

3.  Complete the attributes of the order object (need to complete orderId , status , userId , createTime , updateTime , etc., other attribute pages are passed)

4. Insert order form

5.  Complete the attributes of the order_item object (need to complete orderId , createTime , updateTime , etc., other attribute pages are passed)

6. Insert order item table

7.  Complete the attributes of the order_shipping object (need to complete orderId , createTime , updateTime , etc., other attribute pages are passed)

8. Insert order logistics table

9.  Pass the order number to jsp

10. Return to the logical view (payment page)

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324786638&siteId=291194637