Design and implementation of Langtu automobile store management system based on SSM framework
โ20W+ fans on the whole network, csdn invited author, blog expert, CSDN Rising Star Program Mentor, high-quality creator in java field, blog star, high-quality author on Nuggets/Huawei Cloud/Alibaba Cloud/InfoQ and other platforms, focusing on Java technology field and graduation project practiceโ
๐ Get the project download method at the end of the article๐
1. Project background introduction:
The concept of car beauty has entered China for more than ten years, and the ways of car beauty have gradually developed in various ways. The foothold of many 4S stores in China also shows that the auto beauty industry has officially entered a mature development period. It has to be said that China's auto market is very large. Thanks to China's rapid economic development, people's living standards are improving day by day. Many big cities have realized that cars are a must-have for families, and even many Every family has more than one car. There are more cars, so car stores also appear in all parts of our country like bamboo shoots after spring.
The automotive service industry is considered a relatively good "industry". The main reason is that this industry is a product of the rapid development of social economy, and it is a new type of industry formed according to the increase in car ownership. So what is the after-sales service market for the hot cars? The car after-sales service market can be understood in this way. After you buy a car, if you want to make the interior of the car more beautiful, then the store can help you solve this problem. From a macro point of view, in fact, there are all service stores after buying a car that can help you solve your needs. However, since my country's auto after-sales service market is actually just in its infancy, it is in an extremely unstable state. There will definitely be a fierce competition in the next few years, and the ending after reshuffle is the beginning of the real auto service industry. At that time, the stores that can "survive" through these competitions must be those who know how to use information management technology to operate. Because only those stores that will seize the opportunity can strategize.
Although China's Internet technology has developed relatively well in recent years, compared with those developed countries in the West, there is still a little gap. The reason is that those countries in Europe and the United States mainly advocate the O2O model. This model is actually taking advantage of the advantages of the Internet in today's society and using real information to manage stores. Let the store truly be "unmanaged". The application of the O2O model in China is still relatively small. In fact, many Chinese auto stores are still operating in a purely offline manner. This mode of operation is actually not in line with the current development situation, after all, it belongs to the era of information technology. If a store is a purely offline model, when faced with a huge amount of information, there is no way to manage it manually. Faced with this situation, we can actually learn from the practices of those European and American countries, use databases to access these information, take advantage of the Internet age, and use a fully functional, lightweight, and capable of handling large amounts of data for car store management System to manage stores, so as to truly realize mechanized management and make the operation of auto stores more convenient and advanced.
2. Technical introduction of the project:
- JAVA: Java is an object-oriented programming language. It not only absorbs various advantages of the C++ language, but also abandons concepts such as multiple inheritance and pointers that are difficult to understand in C++. Therefore, the Java language has two characteristics: powerful and easy to use. As a representative of the static object-oriented programming language, the Java language perfectly implements the object-oriented theory and allows programmers to perform complex programming in an elegant way of thinking.
- Spring: The Spring framework is an open source J2EE application framework initiated by Rod Johnson and is a lightweight container for bean lifecycle management. Spring solves many common problems encountered by developers in J2EE development, and provides powerful functions such as IOC, AOP and Web MVC. Spring can be used alone to build applications, and can also be used in combination with many Web frameworks such as Struts, Webwork, and Tapestry, and can be combined with desktop application AP s such as Swing. Therefore, Spring can be applied not only to J2EE applications, but also to desktop applications and applets. The Spring framework is mainly composed of seven parts, namely Spring Core, Spring AOP, Spring ORM, Spring DAO, Spring Context, Spring Web and Spring Web MVC.
- Mybatis: MyBatis was originally iBatis, an open source project of apache. In 2010, this project was migrated from apache software foundation to google code and renamed MyBatis. Migrated to Github in November 2013.
The word iBATIS comes from the combination of "internet" and "abatis", which is a Java-based persistence layer framework. The persistence layer framework provided by iBATIS includes SQL Maps and Data Access Objects (DAOs). - Bootstrap: Bootstrap is a concise, intuitive, and powerful front-end development framework based on HTML, CSS, and JavaScript developed by Mark Otto and Jacob Thornton, designers of Twitter in the United States, making Web development faster. Bootstrap provides elegant HTML and CSS specifications, which are written in the dynamic CSS language Less. Bootstrap has been very popular since its launch and has always been a popular open source project on GitHub, including NASA's MSNBC (Microsoft National Broadcasting Company)'s Breaking News. Frameworks familiar to some mobile developers in China, such as the WeX5 front-end open source framework, are also based on Bootstrap source code for performance optimization.
- Html: The full name of HTML is Hypertext Markup Language, which is a markup language. It includes a series of tags. Through these tags, the document format on the network can be unified, and the scattered Internet resources can be connected into a logical whole. HTML text is a descriptive text composed of HTML commands, which can explain text, graphics, animations, sounds, tables, links, etc.
Hypertext is a way of organizing information. It associates text, graphics and other information media in the text through hyperlinks. These interrelated information media may be in the same text, or may be other files, or files on a computer located at a geographically distant location. This way of organizing information connects information resources distributed in different locations in a random way, providing convenience for people to search and retrieve information.
3. Introduction of system function modules:
4. Database design:
1: Administrator table
(admin)
field name | type | Defaults | column comment |
---|---|---|---|
id | bigint(20) | NULL | primary key ID |
user_name | varchar(50) | NULL | username |
pass_word | varchar(255) | NULL | password |
head_img | varchar(200) | NULL | avatar |
nick_name | varchar(50) | NULL | Nick name |
type | int(3) | NULL | Type[1:Employee |
2: Accessories list
(parts)
field name | type | Defaults | column comment |
---|---|---|---|
id | bigint(20) | NULL | primary key ID |
parts_name | varchar(50) | NULL | Parts name |
supplier_id | bigint(20) | NULL | Supplier |
price | varchar(10) | NULL | unit price |
stock | int(20) | NULL | in stock |
cover_img | varchar(200) | NULL | Accessories |
content | text | NULL | Accessories |
type_id | bigint(20) | NULL | category |
current_stock | int(20) | NULL | Current inventory |
3: Accessories classification
(parts_type)
field name | type | Defaults | column comment |
---|---|---|---|
id | bigint(20) | NULL | primary key ID |
parts_type_name | varchar(255) | NULL | Accessories classification |
4: Service item table
(projects)
field name | type | Defaults | column comment |
---|---|---|---|
id | bigint(20) | NULL | primary key ID |
subscribe_id | bigint(20) | NULL | Appointment Form ID |
user_id | bigint(20) | NULL | User ID |
content | text | NULL | Main service content |
type | int(3) | NULL | Item Category [1: Car Beauty |
5: User appointment form
(subscribe)
field name | type | Defaults | column comment |
---|---|---|---|
id | bigint(20) | NULL | primary key ID |
user_id | bigint(20) | NULL | User ID |
su_info | text | NULL | appointment content |
subscribe_time | datetime | NULL | Appointment |
status | int(3) | NULL | Appointment Status [1: Appointment in progress |
6: Supplier table
(supplier)
field name | type | Defaults | column comment |
---|---|---|---|
id | bigint(20) | NULL | primary key ID |
supplier_name | varchar(50) | NULL | Supplier name |
supplier_type | varchar(50) | NULL | Supplier category |
supplier_localtion | varchar(255) | NULL | Supplier's address |
supplier_boss_name | varchar(50) | NULL | Supplier Contact Name |
supplier_tel | varchar(20) | NULL | contact number |
7: Item Accessories List
(user_parts)
field name | type | Defaults | column comment |
---|---|---|---|
id | bigint(20) | NULL | primary key ID |
parts_id | bigint(20) | NULL | Accessory ID |
use_num | int(20) | NULL | usage amount |
projects_id | bigint(20) | NULL | Maintenance item ID |
8: User table (users)
field name | type | Defaults | column comment |
---|---|---|---|
id | bigint(20) | NULL | primary key ID |
user_name | varchar(255) | NULL | username |
pass_word | varchar(255) | NULL | password |
nick_name | varchar(50) | NULL | Nick name |
sex | int(3) | NULL | Gender[1:Male |
5. Functional modules:
-
The function realization of the front page: when you click to make an appointment now, the modal box of the appointment information will pop up. The appointment information includes name, phone number, reserved store (you can select from the drop-down), reserved business (select from the drop-down), and the reservation information time and notes. After clicking OK to make an appointment, the user will be prompted that the appointment is successful. After clicking ok, you can return to the store home page.
-
Realization of the login page function: When the input account does not exist or the password is wrong, it will prompt that the account or password is wrong. When the entered account password is correct, it will jump to the employee information page and display the currently logged in user name in the menu bar
-
Realization of employee page functions: when you click Add/Edit, you will jump to the edit page. When the entered information does not meet the conditions, it will not be allowed to be saved.
When you click to export the employee table, a table containing all employee information will be directly generated and returned to the user.
When the import button is clicked, the template will be downloaded and the selected file will be downloaded. The user can download the template, then fill in the employee data in the template form, and then select the file just written. After clicking Save, it will jump back to the employee information page. -
Realization of permission page function: Because the code of the system may be changed, it is necessary to provide a button on the page to synchronize the permission expression with the database permission expression. Click the reload button, and you will be prompted whether to reload the permissions. After clicking OK, the permissions page will be updated.
-
Implementation of the announcement page function: when the view button is clicked, the corresponding read status will be changed to read. And it will jump to the page to view the announcement.
When you click the Publish button, the status will change to Published, and the announcement page will be refreshed at the same time. -
Realization of the store information page function: When you click Edit, you will enter the information editing page, and there is a button to view the attachment. When you click this button, the store's business license photo will be opened. A file can be selected to be uploaded as a photo of the business license.
-
Realization of the reservation information page function: when clicking to confirm the reservation, the status of the reservation form will change to fulfilling. When you click Cancel Appointment, the status of the Appointment Form will change to Obsolete.
6. Code example:
Functional realization of the front page
/** * Show front-end page method * @param model * @return */ @RequestMapping("/index") public String index(Model model){ //Get all data dictionaries List<SystemDictionary>systemDictionaries=systemDictionaryService.selectTitle("business"); model.addAttribute("systemDictionaries",systemDictionaries); //Get the main store object Business business = businessService.getBymainStore(true); model.addAttribute("business",business); //Get all store information List<Business> businesses = businessService.listAll(); model.addAttribute("businesses",businesses); return "index"; }
Implementation of login page functionality
public class LoginController { @Autowired private IEmployeeService employeeService; @RequestMapping("/empLogin") @ResponseBody public JsonResult empLogin(String username,String password){ try { UsernamePasswordToken token = new UsernamePasswordToken(username,password); SecurityUtils.getSubject().login(token); return new JsonResult(); } catch (UnknownAccountException e) { return new JsonResult(false, "Account does not exist"); } catch (IncorrectCredentialsException e) { return new JsonResult(false, "wrong password"); } catch (Exception e) { e.printStackTrace(); return new JsonResult(false, "Login is abnormal, please contact the administrator"); } }
Realization of employee page functions
public class CheckLoginInterceptor implements HandlerInterceptor { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { if (handler instanceof HandlerMethod){ //All intercepted requests are requests for dynamic resources //Determine whether there is a login, if there is a release, if there is no jump to the login page Object emp = request.getSession().getAttribute(UserContext.USER_IN_SESSION); if (emp == null){ response.sendRedirect("/login.html"); return false; } } return true; } }
Realization of permission page function
public void reload() { //1. Check out all the permission information of the database at one time. List<Permission> permissions = permissionMapper.selectAll(); //2. Create a set collection to store permission expressions Set<String> expressionSet = new HashSet<>(); for(Permission p:permissions){ //3. Add all permission information to the collection expressionSet.add(p.getExpression()); } //Get all the RequiredPermission annotations, take out the name and expression on the annotations, // Encapsulate it as Permission and save it in the database //HandlerMethod represents a method reference for each control Map<RequestMappingInfo, HandlerMethod> handlerMethods = rmhm.getHandlerMethods(); Collection<HandlerMethod> values = handlerMethods.values(); for(HandlerMethod method:values){ // Get method annotations RequiresPermissions annotation = method.getMethodAnnotation(RequiresPermissions.class); // There are our custom permission annotations on the method if (annotation != null) { // Get method annotation name and expression value String name = annotation.value()[1]; String expression = annotation.value()[0]; // Make a judgment before storing it in the database, if it does not exist in the database, store it if(!expressionSet.contains(expression)) { Permission permission = new Permission(); permission.setName(name); permission.setExpression(expression); permissionMapper.insert(permission); } } } }
Realization of announcement page function
@Override public Notice get(Long id) { Notice notice = noticeMapper.selectByPrimaryKey(id); //When clicking to view, the intermediate table inserts data noticeMapper.insertEmpNotice(UserContext.getEmployee().getId(),id); return notice; }
Realization of store information page function
@RequiresPermissions(value = {"business:saveOrUpdate","store editor"}, logical = Logical.OR) public String saveOrUpdate(Business business, MultipartFile file) throws Exception { if (file != null && file.getSize()>0) { //Handle uploaded operations String realPath = servletContext.getRealPath("/"); //If it exists, upload it when editing and delete the previous one if (StringUtils.hasText(business.getLicenseImg())) { //Spell out the deleted path String deletePath = realPath + business.getLicenseImg(); FileUploadUtil.deleteFile(deletePath); } String filePath = FileUploadUtil.uploadFile(file, realPath); business.setLicenseImg(filePath); } if (business.getId() == null) { businessService.save(business); } else { businessService.update(business); } return "redirect:/business/list"; }
Realization of reservation information page function
//Modify the reservation status function @RequestMapping("/updateStatus") public String updateStatus(Long id ,Integer status){ appointmentService.updateStatus(id,status); return "redirect:/appointment/list"; } void updateStatus(@Param("id") Long id, @Param("status") Integer status); <update id="updateStatus"> update appointment set status = #{status} where id = #{id} </update>
7. Paper reference:
8. Project summary:
During this graduation project, I learned a lot of new technologies. In the past, when Baidu developed technology, I always felt that it would be good to understand these things. Isn't it something that can be easily grasped by then? Through the development of this graduation design project, I really realized that if you just understand a technology, then you can only tell the main points of the technology, and if you really implement it, you will find that it is more difficult than reaching the sky. In fact, computer knowledge focuses on practice. Only when you are really familiar with these technologies can you be said to understand them.
However, since it is the first time to manually develop a complete set of projects based on the SSM framework, there are still many system problems. For example, on the selection of front-end pages, I use the template pages of various framework technologies; the design of tables in the database may also have the problem of disordered relationships. But in this development process, I also gained a lot of development experience that I didn't have before. Have a deeper understanding of Bootstrap, Jquery, Freemarker, mybatis and other frameworks or technologies. It also laid a solid foundation for my study, life and work after graduation.
The biggest gain in this design is not the mastery of technology, but the understanding that the development of a project must be well planned. You can't be clueless like a headless fly. Only by planning the entire process of the project in detail, recording it with documents, and then realizing the requirements of the project step by step can the system come to life. The development process will not be smooth sailing. When encountering system problems, I have benefited from this development from being helpless before to being calm now. Now when I encounter problems, I will first analyze the process of the system, and then analyze the logic of the code implementation according to the process. If I can't solve it, I will use the power of Baidu. When the problem is very difficult, I will choose to ask Bi She’s tutor, Mr. Zhou Shaobo, for help. I think we should have this kind of attitude when working after graduation, so that we can really develop the project well.
The projects made in this graduation design may not be able to meet the real enterprise requirements, and there is still a certain gap with the real practical application. The reason is that the collected information is not sufficient, the understanding of the actual situation is not deep enough, and the analysis of the system is not thorough enough. But with this development experience, I believe that I can avoid many detours in the future development road, and can also develop a project system that can really be applied in real life.
9. Source code acquisition:
Everyone like, favorite, follow, comment, view ๐๐ป๐๐ป๐๐ปGet contact information๐๐ป๐๐ป๐๐ป
Click on the link to go directly to: download link