Dark Horse Project Phase I Interview 58 Questions Cangqiong Takeaway Business Logic 15 Questions

1. Employee login process

1. The front end logs in on the login page and sends a request

2. Enter the interceptor, which releases all login page requests.

3. Enter the three-tier architecture and query whether the user exists. If it exists, add salt and encrypt it, return the JWT token, and store it in the request header. If the user does not exist, you cannot log in.

2. How to implement login verification

1. Try to access any non-login interface, and the front end sends a request

2. Enter the interceptor and start intercepting and verifying JWT.

3. If the verification is successful, the access interface will be entered. Otherwise, jump to the login interface.

3. What are the roles in project development?

project manager

Division of labor for the entire project and responsible for progress control.

Project management software may be used, such as ZenTao and Ones.

Apart from the project manager, the second most awesome person is:

product manager

Conduct demand research and analysis, and output demand research documents and product prototypes.

I have more dealings with the leaders above, but it’s not that the leader is better than the leader, it’s just a job title. This means that I make demands and you fulfill them. You are making demands, so you should generally be more aggressive.

(Product managers who meet requirements are programmers’ natural enemies)

UI designer

Output the interface renderings based on the product prototype.

It doesn’t necessarily belong to the young lady.

Architect

The overall architecture design of the project, that is, the construction of the overall structure of the project, as well as technology selection, etc.

For example, whether to choose microservices or monolithic architecture, what technology to use, and what modules to design,

As well as some thorny problems, architects are responsible for them.

Architects don’t have to be great, some are great and some are bad. Some large companies have groups, including architect groups. Not all the things inside may be something you can admire to the point of standing tall at the top of a mountain~

Development Engineer

Code.

Well, here comes the hardworking coder.

Test Engineer

Write test cases and output test reports.

Operation and Maintenance Engineer

Set up the software environment and run the project.

other

There may be other detailed directions within the company, such as DBA, which is a database administrator.

They just write SQL statements.

4. Process of editing employees

1. Improve the previous process of storing employee ID in the thread when logging in.

2. Complete the echo function, that is, query the employees based on their IDs.

3. Complete the modification function, that is, update employee data.

5. Implementation process of automatic filling of public fields

1. Make sure to use AOP technology.

2. Create a custom annotation under the com.sky.annotation package, such as AutoFill

3. Use an enumeration class to represent the two states of update and new, and put it in a custom annotation.

4. Customize the aspect class under the com.sky.aspect package

5. Improve the automatic filling logic of aspect classes, judge the update and new status, and perform different processing.

6. Add custom annotations to the corresponding methods in mapper

6. Process of adding new dishes

1. Implement file upload.

(1)Introduce your own Alibaba Cloud in the configuration file.

(2) Write a class, such as AliOssProperties, to read the configuration file.

(3) Write a tool class to upload files.

(4) Use a configuration class, such as OssConfiguration, to generate OSS tool class objects.

(5) Inject and call in the three-tier architecture to implement file upload. Among them, UUID is used to randomly generate file names.

2. Add text details for new dishes. Note that two tables need to be added, one dish and one dish_flavor.

7. Process of deleting dishes

Note that the business layer is divided into four steps:

1. Determine whether to start selling

2. Determine whether it is associated with the package

3. Delete data in the menu table

4. Delete the taste data associated with the dish

8. Process of modifying dishes

First implement the search based on id

Then implement the modification

Note that when modifying flavors, you must first delete the original flavors and then insert them into a single for loop, or insert multiple flavors together.

9. WeChat login process

1. The controller layer receives the authorization code passed from the front end and calls the service layer to find out whether the authorization code passes the verification.

2. The service layer checks whether the authorization code is valid. If it is invalid, an exception will be thrown; if it is valid, the mapper layer will be called to query the user.

3. The mapper layer searches for existing users and returns the service value.

4. In service, if the user exists, return directly; if not, complete the automatic registration of the user and return the user to the controller layer.

5. The controller gets the returned user, that is, after the user exists or is registered, it encapsulates the response object and finally returns it to the front end.

To summarize the 3-tier architecture:

controller layer:

        1. Use DTO to receive authorization code

        2. Hand it to the service layer to verify whether the authorization code is valid and get the return value to the user.

        3. Encapsulate the returned user to VO and return it to the front end

service layer:

        1. Prepare parameters and use WeChat third party to verify whether the authorization code is valid.

        2. Parse the response parameters and obtain the openid. If it is empty, the verification is invalid and an exception is thrown.

        3. According to the openid, let the mapper query the user list. If there is no corresponding user, complete the automatic registration;

        4. Return to user

mapper layer:

        According to openid, query whether the user exists

10. Cache dish process

1. Add code in the service layer. Add the following code:

        1.1 Query redis.

        1.2 If there is no data in redis, use mapper to query the data. If so, jump directly to step 1.4

        1.3 Store the data detected by mapper into redis.

        1.4 Return data

11. Add shopping cart process

1. The front end passes the dishes/set meals and flavors to the controller layer.

2. The controller layer hands it to the service layer to add it to the shopping cart.

        2.1 Determine whether the item already exists in the shopping cart. Call the mapper layer and select it.

        2.2 If it exists, only modify the quantity and let the mapper update the quantity.

        2.3 If it does not exist, add the dishes or packages to the shopcart object by category.

                2.3.1 If it is a dish, find out the dish, ID, picture, etc.

                2.3.2 If it is a package, find out the package, ID, picture, etc.

        2.4 Add the shopcart object to the database and mapper insert it.

3.Mapper layer photo operation

12. User order process

1. Query address

2. Query shopping cart

3. Package the order and add one

4. Encapsulate the order details, it is possible to add multiple items

5. Clear shopping cart

6. Encapsulate VO and return

13. WeChat payment process

1. Call the WeChat order interface;

2. Return the prepayment transaction ID;

3. Sign the combined data again;

4. Push payment results;

5. Update order status.

14. Order reminder and user order reminder implementation process

Order reminder:

Add WebSocket injection to the business layer code that submits orders, and then transmit the map with order information.

User reminder:

The order reminder function is written in the three-tier architecture, and WebSocket is also used to inject and realize two-way communication.

15. Implementation process of exporting operational data

  1. Read the Excel template into memory.

  2. Prepare operational data

  3. Write data into Excel template.

  4. Respond to the Excel document back to the browser (file download)

 

Points to note

The file location that ClassLoader can load

The file location that ClassLoader can load is under resources.

Operations required after placing resources

You need to compile it with maven build management complie to ensure that the class loader ClassLoader is loaded.

The subscript corresponding to the created POI and Office

In the subscript, getRow(0) and getCell(1) correspond to the data in the first column and row 2 respectively.

Guess you like

Origin blog.csdn.net/m0_46948660/article/details/132270151