Driving school reservation | Design and implementation of driving school reservation system based on Vue+Springboot

 Author Home Page: Programming Compass

About the author: High-quality creator in the Java field, CSDN blog expert, CSDN content partner, Nuggets guest author, Alibaba Cloud blog expert, 51CTO guest author, many years of architect design experience, Tencent classroom resident lecturer

Main contents: Java projects, Python projects, front-end projects, artificial intelligence and big data, resume templates, study materials, interview question bank, technical mutual assistance

Collect, like and don’t get lost. It’s good to follow the author.

Get the source code at the end of the article 

Project number: BS-XX-184

1. Introduction to the environment

Locale: Java: jdk1.8

Database: Mysql: mysql5.7

Application server: Tomcat: tomcat8.5.31

Development tools: IDEA or eclipse

Development technology: Springboot+Vue front-end and back-end separation

2. Project Introduction

The main research topic of this topic is the development and implementation of the driving school reservation management system. The choice of this topic is mainly based on the current background that the number of domestic cars is increasing year by year, the number of cars owned by families is also increasing, and the popularity of adult driving tests continues to rise. As the number of people taking driving tests continues to increase, the business of various driving schools can be said to be very prosperous. However, the traditional driving school registration and management methods make the customer experience very poor. According to survey statistics, 80% of people are not satisfied with the management and driving practice of driving schools. The service is not very satisfactory, and I feel that there is a lot of room for improvement. The biggest problem is that there are queues for driving practice, which wastes a lot of personal time. So how to use information technology to help these driving schools develop and implement a management system for driving reservations, so that students can make reservations online in advance through this system and achieve effective and reasonable driving arrangements, is an important research issue in this system.

This topic mainly uses information software development technology to develop and implement a driving practice reservation management system, so that students can make reservations for driving training online, and coaches can view driving training information online, score students, and score points based on students' driving practice records. , estimate the pass rate of students' scheduled driving practice, and at the same time, it can complete the management of online car maintenance information, the management of basic information such as students, coaches, courses, cars, etc., and can complete a comprehensive information management function for driving schools through this system. Effectively improve students' driving experience and improve the management system of the driving school itself.

Technically, the development and design of this system mainly uses JAVA back-end development technology and VUE front-end development technology to develop and implement it, and adopts the front-end and back-end separation method to develop and implement it. The system provides a front-end operation interface for front-end users to answer questions, and a back-end management interface for back-end administrators. The back-end service interface is developed and implemented using Springboot framework technology, and the Mybatis-plus persistence layer framework is integrated to complete data persistence and business data storage. MYSQL5.7 is used for data storage.

This topic is a driving school appointment driving practice system. Since I also have the experience of taking a driving license test at a driving school, I have gone through the painful process of queuing up to practice driving. At the same time, I have visited a large number of driving test takers, read a lot of literature and referred to similar driving test platforms to analyze the system. basic functional requirements. After analysis, it is determined that the users of the system are mainly divided into two categories: student users, coach users and backend management users. The main functions of students are: online user registration and login, online course browsing, viewing coach details, vehicle information viewing, and online reservation for driving practice. Implementation and personal center management. The main functions of backend management users include: user information management module, personal information management module, vehicle information management, coach information management, reservation data management, student information management, vehicle maintenance management, course management, etc. The main functions of the coach include: course management, student management, vehicle management, maintenance reporting management, student appointment record management and other functions.

The specific system functional structure diagram of the driving school reservation driving training system is shown in Figure 1 below:

Figure 1 System functional architecture

3. System display

 This chapter mainly shows the implementation of the relevant core functions of the driving school reservation driving training system. It mainly shows how the system modules are implemented through the function module interface and code. The following is the main business function modules of the system's student users and background administrators. Make a unified presentation.

3.1 Implementation of student function module

3.1.1 User registration and login

Student users of the driving school reservation driving training system can register as members on the registration page provided by the system platform. After registration, users can log in accordingly. After the login authentication is passed, they can perform corresponding operations online. User registration is shown in Figure 3.1 :

Figure 3.1 User registration

   The student user login interface is shown in Figure 3.2 below. After the user enters the account and password, select his or her identity and submit the information to the backend service interface. Administrators, students, and coaches use the same interface to log in. The specific display interface is as shown below. As shown in 3.2.

Figure 3.2 User login interface

3.1.2 Personal Center

After logging in to the system, students can manage their personal information in the personal center module and change their passwords online. The specific functions are shown in Figures 3.3 and 3.4 below.

Figure 3.3 Personal information management

Figure 3.4 Personal password management

3.1.3 View vehicle information

After logging in to the system, students can view the vehicle information currently owned by the driving school in the vehicle management module, as shown in Figure 3.5 below:

Figure 3.5 Vehicle View

3.1.4 Coach viewing module

After students log in to the system, they can view the coach information currently owned by the driving school in the coach management module, as shown in Figure 4.6 below:

Figure 3.6 Coach Management

3.1.5 Course Management Module

After logging in to the system, students can view the course information currently set by the driving school in the course management module, as shown in Figure 3.7 below:

Figure 3.7 Course Management

3.1.6 Online reservation module

After students log in to the system, they can make online reservations in the online reservation management module, complete reservation additions and information viewing, as shown in Figure 3.8 below:

Figure 3.8 Reservation management

Figure 4.9 Online reservation

3.2 Coaching function module (omitted)

3.3 Administrator function module (omitted)

4. Core code display


package com.controller;


import java.util.Arrays;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import com.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.UsersEntity;
import com.service.TokenService;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;

/**
 * 登录相关
 */
@RequestMapping("users")
@RestController
public class UsersController {
	
	@Autowired
	private UsersService usersService;
	
	@Autowired
	private TokenService tokenService;

	/**
	 * 登录
	 */
	@IgnoreAuth
	@PostMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		UsersEntity user = usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", username));
		if(user==null || !user.getPassword().equals(password)) {
			return R.error("账号或密码不正确");
		}
		String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
		R r = R.ok();
		r.put("token", token);
		r.put("role",user.getRole());
		r.put("userId",user.getId());
		return r;
	}
	
	/**
	 * 注册
	 */
	@IgnoreAuth
	@PostMapping(value = "/register")
	public R register(@RequestBody UsersEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        usersService.insert(user);
        return R.ok();
    }

	/**
	 * 退出
	 */
	@GetMapping(value = "logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	UsersEntity user = usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
    	user.setPassword("123456");
        usersService.update(user,null);
        return R.ok("密码已重置为:123456");
    }
	
	/**
     * 列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,UsersEntity user){
        EntityWrapper<UsersEntity> ew = new EntityWrapper<UsersEntity>();
    	PageUtils page = usersService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/list")
    public R list( UsersEntity user){
       	EntityWrapper<UsersEntity> ew = new EntityWrapper<UsersEntity>();
      	ew.allEq(MPUtil.allEQMapPre( user, "user")); 
        return R.ok().put("data", usersService.selectListView(ew));
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
        UsersEntity user = usersService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Integer id = (Integer)request.getSession().getAttribute("userId");
        UsersEntity user = usersService.selectById(id);
        return R.ok().put("data", user);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody UsersEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        usersService.insert(user);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UsersEntity user){
//        ValidatorUtils.validateEntity(user);
        usersService.updateById(user);//全部更新
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        usersService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

package com.controller;

import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;

import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;

/**
 * 练车记录
 * 后端接口
 * @author
 * @email
*/
@RestController
@Controller
@RequestMapping("/lianchejilu")
public class LianchejiluController {
    private static final Logger logger = LoggerFactory.getLogger(LianchejiluController.class);

    private static final String TABLE_NAME = "lianchejilu";

    @Autowired
    private LianchejiluService lianchejiluService;


    @Autowired
    private TokenService tokenService;

    @Autowired
    private CheliangService cheliangService;//车辆
    @Autowired
    private CheliangWeixiuService cheliangWeixiuService;//车辆维修
    @Autowired
    private DictionaryService dictionaryService;//字典
    @Autowired
    private JiaolianService jiaolianService;//教练
    @Autowired
    private KechengService kechengService;//课程
    @Autowired
    private KechengBaomingService kechengBaomingService;//练车预约
    @Autowired
    private YonghuService yonghuService;//学员
    @Autowired
    private UsersService usersService;//管理员


    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永不会进入");
        else if("学员".equals(role))
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        else if("教练".equals(role))
            params.put("jiaolianId",request.getSession().getAttribute("userId"));
        CommonUtil.checkMap(params);
        PageUtils page = lianchejiluService.queryPage(params);

        //字典表数据转换
        List<LianchejiluView> list =(List<LianchejiluView>)page.getList();
        for(LianchejiluView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c, request);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        LianchejiluEntity lianchejilu = lianchejiluService.selectById(id);
        if(lianchejilu !=null){
            //entity转view
            LianchejiluView view = new LianchejiluView();
            BeanUtils.copyProperties( lianchejilu , view );//把实体数据重构到view中
            //级联表 车辆
            //级联表
            CheliangEntity cheliang = cheliangService.selectById(lianchejilu.getCheliangId());
            if(cheliang != null){
            BeanUtils.copyProperties( cheliang , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "jiaolianId"
, "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
            view.setCheliangId(cheliang.getId());
            }
            //级联表 学员
            //级联表
            YonghuEntity yonghu = yonghuService.selectById(lianchejilu.getYonghuId());
            if(yonghu != null){
            BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "jiaolianId"
, "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
            view.setYonghuId(yonghu.getId());
            }
            //级联表 教练
            //级联表
            JiaolianEntity jiaolian = jiaolianService.selectById(lianchejilu.getJiaolianId());
            if(jiaolian != null){
            BeanUtils.copyProperties( jiaolian , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "jiaolianId"
, "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
            view.setJiaolianId(jiaolian.getId());
            }
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody LianchejiluEntity lianchejilu, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,lianchejilu:{}",this.getClass().getName(),lianchejilu.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");
        else if("教练".equals(role))
            lianchejilu.setJiaolianId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
        else if("学员".equals(role))
            lianchejilu.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));


        List<LianchejiluEntity> lianchejiluEntities = lianchejiluService.selectList(new EntityWrapper<LianchejiluEntity>()
                .eq("yonghu_id", lianchejilu.getYonghuId())
                .eq("kemu_types", lianchejilu.getKemuTypes())
        );

        //添加练车记录时,会根据得分来计算平均分,平均分-30得到通过率(自己可以改算法)
        if(lianchejiluEntities.size()>0){
            BigDecimal zongfen = new BigDecimal(0.0);
            for(LianchejiluEntity l:lianchejiluEntities){
                zongfen=zongfen.add(new BigDecimal(l.getLianchejiluDefen()));
            }
            //计算平均分,来测试通过率
            BigDecimal pingjunfen = zongfen.divide(new BigDecimal(lianchejiluEntities.size()));
            if(lianchejiluEntities.size()<10 && pingjunfen.doubleValue()>35){
                pingjunfen=pingjunfen.subtract(new BigDecimal(30));
            }

            YonghuEntity yonghuEntity = yonghuService.selectById(lianchejilu.getYonghuId());
            if(yonghuEntity != null){
                //设置科目2的通过率
                if(lianchejilu.getKemuTypes() ==1)
                    yonghuEntity.setErTongguolv(pingjunfen.doubleValue());
                //设置科目3的通过率
                if(lianchejilu.getKemuTypes() ==2)
                    yonghuEntity.setSanTongguolv(pingjunfen.doubleValue());

                yonghuService.updateById(yonghuEntity);
            }
        }

        //根据分类来判断练车结果
        if(lianchejilu.getLianchejiluDefen()>90)
            lianchejilu.setLianchejiluTypes(4);
        else if(lianchejilu.getLianchejiluDefen()>80)
            lianchejilu.setLianchejiluTypes(3);
        else if(lianchejilu.getLianchejiluDefen()>60)
            lianchejilu.setLianchejiluTypes(2);
        else
            lianchejilu.setLianchejiluTypes(1);
        lianchejilu.setCreateTime(new Date());
            lianchejiluService.insert(lianchejilu);
            return R.ok();
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody LianchejiluEntity lianchejilu, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
        logger.debug("update方法:,,Controller:{},,lianchejilu:{}",this.getClass().getName(),lianchejilu.toString());
        LianchejiluEntity oldLianchejiluEntity = lianchejiluService.selectById(lianchejilu.getId());//查询原先数据

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
//        else if("教练".equals(role))
//            lianchejilu.setJiaolianId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
//        else if("学员".equals(role))
//            lianchejilu.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));

        //根据分类来判断练车结果
        if(lianchejilu.getLianchejiluDefen()>90)
            lianchejilu.setLianchejiluTypes(4);
        else if(lianchejilu.getLianchejiluDefen()>80)
            lianchejilu.setLianchejiluTypes(3);
        else if(lianchejilu.getLianchejiluDefen()>60)
            lianchejilu.setLianchejiluTypes(2);
        else
            lianchejilu.setLianchejiluTypes(1);

            lianchejiluService.updateById(lianchejilu);//根据id更新
            return R.ok();
    }



    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        List<LianchejiluEntity> oldLianchejiluList =lianchejiluService.selectBatchIds(Arrays.asList(ids));//要删除的数据
        lianchejiluService.deleteBatchIds(Arrays.asList(ids));

        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName, HttpServletRequest request){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try {
            List<LianchejiluEntity> lianchejiluList = new ArrayList<>();//上传的东西
            Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
            Date date = new Date();
            int lastIndexOf = fileName.lastIndexOf(".");
            if(lastIndexOf == -1){
                return R.error(511,"该文件没有后缀");
            }else{
                String suffix = fileName.substring(lastIndexOf);
                if(!".xls".equals(suffix)){
                    return R.error(511,"只支持后缀为xls的excel文件");
                }else{
                    URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
                    File file = new File(resource.getFile());
                    if(!file.exists()){
                        return R.error(511,"找不到上传文件,请联系管理员");
                    }else{
                        List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
                        dataList.remove(0);//删除第一行,因为第一行是提示
                        for(List<String> data:dataList){
                            //循环
                            LianchejiluEntity lianchejiluEntity = new LianchejiluEntity();
                            lianchejiluEntity.setYonghuId(Integer.valueOf(data.get(0)));   //学员 要改的
                            lianchejiluEntity.setCheliangId(Integer.valueOf(data.get(0)));   //车辆 要改的
                            lianchejiluEntity.setJiaolianId(Integer.valueOf(data.get(0)));   //教练 要改的
                            lianchejiluEntity.setKemuTypes(Integer.valueOf(data.get(0)));   //所属科目 要改的
                            lianchejiluEntity.setLianchejiluKaishiTime(sdf.parse(data.get(0)));          //练车开始时间 要改的
                            lianchejiluEntity.setLianchejiluShichang(Integer.valueOf(data.get(0)));   //练车时长 要改的
                            lianchejiluEntity.setLianchejiluDefen(Double.parseDouble(data.get(0)));                    //本次成绩 要改的
                            lianchejiluEntity.setLianchejiluTypes(Integer.valueOf(data.get(0)));   //练车成果 要改的
                            lianchejiluEntity.setLianchejiluContent("");//详情和图片
                            lianchejiluEntity.setCreateTime(date);//时间
                            lianchejiluList.add(lianchejiluEntity);


                            //把要查询是否重复的字段放入map中
                        }

                        //查询是否重复
                        lianchejiluService.insertBatch(lianchejiluList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }




}

5. Display of related works

Practical projects based on Java development, Python development, PHP development, C# development and other related languages

Front-end practical projects developed based on Nodejs, Vue and other front-end technologies

Related works based on WeChat applet and Android APP application development

Development and application of embedded Internet of Things based on 51 microcontroller and other embedded devices

AI intelligent applications based on various algorithms

Various data management and recommendation systems based on big data

 

 

Guess you like

Origin blog.csdn.net/whirlwind526/article/details/133498641