使用SSM+Layui+Bootstrap实现汽车维保系统的示例代码

本项目主要实现对汽车维修厂的信息化管理功能,主要包含三个角色:管理员,维修师傅,客户。实现的主要功能包含用户管理、配置管理、汽车管理、故障管理、供应商管理、配件管理、维修订单管理、统计信息、公告管理、个人信息管理。主要业务流程:用户在系统内发起汽车维修申请定单,管理员根据情况将定单分配给维修师傅,维修师傅接受任务后开始维修,并根据情况申请配件,处理完成后由管理员生成最终支付订单结算费用,客户进入系统进行费用支付,并可以查看自己相应的维修记录和费用信息等等。

技术架构:

后台开发:SSM框架

前端技术:Layui+Jquery+Ajax

数据库:MYSQL

开发工具:IDEA /Eclipse

管理员登陆系统后的主要功能:

用户管理

配件管理

供应商管理

采购管理

车辆信息管理

故障管理

维修订单管理

统计管理

公告管理

库存管理

员工登陆系统

相应的管理模块

用户登陆系统

用户相关管理模块

以上是汽车维修管理系统的部分功能展示。

系统部分核心代码;

package com.lzm.controller.admin;
 
import com.lzm.pojo.ApplyInfo;
import com.lzm.pojo.CarInfo;
import com.lzm.pojo.OrderInfo;
import com.lzm.pojo.UserInfo;
import com.lzm.service.Interface.OrderService;
import com.lzm.utils.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpSession;
import java.util.List;
 
/**
 * @author znz
 * @create 2021- 04- 03- 9:38
 */
@Controller
public class OrderController {
    @Autowired
    private OrderService orderService;
 
    @RequestMapping(value="/ShowHistoryOrders.action",method = RequestMethod.GET)
    @ResponseBody
    public PageResult<List<OrderInfo>> ShowHistoryOrders(@RequestParam(value = "page") int page , int limit) {
        List<OrderInfo> orderInfos = orderService.ShowHistoryOrders(page,limit);
        System.out.println(orderInfos);
        //返回的总记录数
        int count=orderService.findHistoryOrdersPageCount();
        PageResult<List<OrderInfo>> listPageResult=new PageResult<List<OrderInfo>>("",orderInfos,0,count);
        return listPageResult;
    }
 
 
    @RequestMapping(value="/selectHistoryOrderByName.action",method = RequestMethod.GET)
    @ResponseBody
    public PageResult<List<OrderInfo>> selectHistoryOrderByName(@RequestParam(value = "page") int page , int limit,String contact) {
        List<OrderInfo> orderInfos = orderService.selectHistoryOrderByName(contact);
        //返回的总记录数
        int count=orderInfos.size();
        PageResult<List<OrderInfo>> listPageResult=new PageResult<List<OrderInfo>>("",orderInfos,0,count);
        return listPageResult;
    }
 
 
    @RequestMapping(value="/ShowHandleOrders.action",method = RequestMethod.GET)
    @ResponseBody
    public PageResult<List<OrderInfo>> ShowHandleOrders(@RequestParam(value = "page") int page , int limit) {
        List<OrderInfo> orderInfos = orderService.ShowHandleOrders(page,limit);
        System.out.println(orderInfos);
        //返回的总记录数
        int count=orderService.findHandleOrdersPageCount();
        PageResult<List<OrderInfo>> listPageResult=new PageResult<List<OrderInfo>>("",orderInfos,0,count);
        return listPageResult;
    }
 
 
    @RequestMapping(value="/selectHandleOrderByName.action",method = RequestMethod.GET)
    @ResponseBody
    public PageResult<List<OrderInfo>> selectHandleOrderByName(@RequestParam(value = "page") int page , int limit,String contact) {
        List<OrderInfo> orderInfos = orderService.selectHandleOrderByName(contact);
        //返回的总记录数
        int count=orderInfos.size();
        PageResult<List<OrderInfo>> listPageResult=new PageResult<List<OrderInfo>>("",orderInfos,0,count);
        return listPageResult;
    }
 
 
 
    @RequestMapping(value="/AddOrder.action",method = RequestMethod.POST)
    @ResponseBody
    public int AddOrder(@RequestBody OrderInfo orderInfo) {
            int  a=orderService.AddOrder(orderInfo);
            return a;
    }
 
 
    @RequestMapping(value="/ShowStaffOrders.action",method = RequestMethod.GET)
    @ResponseBody
    public PageResult<List<OrderInfo>> ShowStaffOrders(HttpSession session,@RequestParam(value = "page") int page , int limit) {
        UserInfo user = (UserInfo) session.getAttribute("user");
        String id = user.getUserid();
        List<OrderInfo> orderInfos = orderService.ShowStaffOrders(id,page,limit);
        System.out.println(orderInfos);
        //返回的总记录数
        int count=orderService.findStaffOrdersPageCount(id);
        PageResult<List<OrderInfo>> listPageResult=new PageResult<List<OrderInfo>>("",orderInfos,0,count);
        return listPageResult;
    }
 
    @RequestMapping(value="/selectStaffOrderByName.action",method = RequestMethod.GET)
    @ResponseBody
    public PageResult<List<OrderInfo>> selectStaffOrderByName(HttpSession session,@RequestParam(value = "page") int page , int limit,String contact) {
        UserInfo user = (UserInfo) session.getAttribute("user");
        String id = user.getUserid();
        List<OrderInfo> orderInfos = orderService.selectStaffOrderByName(id,contact);
        //返回的总记录数
        int count=orderInfos.size();
        PageResult<List<OrderInfo>> listPageResult=new PageResult<List<OrderInfo>>("",orderInfos,0,count);
        return listPageResult;
    }
 
 
    @RequestMapping(value="/ShowClientOrders.action",method = RequestMethod.GET)
    @ResponseBody
    public PageResult<List<OrderInfo>> ShowClientOrders(HttpSession session,@RequestParam(value = "page") int page , int limit) {
        UserInfo user = (UserInfo) session.getAttribute("user");
       String  id = user.getUserid();
        List<OrderInfo> orderInfos = orderService.ShowClientOrders(id,page,limit);
        System.out.println(orderInfos);
        //返回的总记录数
        int count=orderService.findClientOrdersPageCount(id);
        PageResult<List<OrderInfo>> listPageResult=new PageResult<List<OrderInfo>>("",orderInfos,0,count);
        return listPageResult;
    }
 
    @RequestMapping(value="/selectClientOrderByName.action",method = RequestMethod.GET)
    @ResponseBody
    public PageResult<List<OrderInfo>> selectClientOrderByName(HttpSession session,@RequestParam(value = "page") int page , int limit,String contact) {
        UserInfo user = (UserInfo) session.getAttribute("user");
        String id = user.getUserid();
        List<OrderInfo> orderInfos = orderService.selectClientOrderByName(id,contact);
        //返回的总记录数
        int count=orderInfos.size();
        PageResult<List<OrderInfo>> listPageResult=new PageResult<List<OrderInfo>>("",orderInfos,0,count);
        return listPageResult;
    }
}
package com.lzm.controller.admin;
 
import com.lzm.pojo.CarInfo;
import com.lzm.pojo.PartsInfo;
import com.lzm.pojo.UserInfo;
import com.lzm.service.Interface.PartService;
import com.lzm.utils.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
/**
 * @author znz
 * @create 2021- 03- 31- 10:10
 */
@Controller
public class PartsController {
    @Autowired
    private PartService partService;
 
 
    @RequestMapping(value="/ShowAllParts.action",method = RequestMethod.GET)
    @ResponseBody
    public PageResult<List<PartsInfo>>    ShowAllParts(@RequestParam(value = "page") int page , int limit) {
        List<PartsInfo> partsInfos = partService.selectAllPart(page,limit);
        System.out.println(partsInfos.toString());
        //返回的总记录数
        int count=partService.findPartPageCount();
        PageResult<List<PartsInfo>> listPageResult=new PageResult<List<PartsInfo>>("",partsInfos,0,count);
        return listPageResult;
 
    }
 
 
    @RequestMapping(value="/updatePart.action",method = RequestMethod.POST)
    @ResponseBody
    public int updateCar( @RequestBody PartsInfo  partsInfo) {
        int i = partService.updatePart(partsInfo);
        return i;
    }
 
    @RequestMapping(value="/selectPartByName.action",method = RequestMethod.GET)
    @ResponseBody
    public PageResult<List<PartsInfo>> selectPartByName(@RequestParam(value = "page") int page , int limit,String plate) {
        List<PartsInfo> partsInfos = partService.selectPartByName(plate);
        //返回的总记录数
        int count=partsInfos.size();
        PageResult<List<PartsInfo>> listPageResult=new PageResult<List<PartsInfo>>("",partsInfos,0,count);
        return listPageResult;
    }
 
 
    //根据ID删除车辆
    @RequestMapping(value="/deletePart.action",method = RequestMethod.GET)
    @ResponseBody
    public int deletePart(int id) {
        int a=partService.deletePartByID(id);
        return a;
    }
 
 
    @RequestMapping(value="/AddPart.action",method = RequestMethod.POST)
    @ResponseBody
    public int AddPart(@RequestBody PartsInfo partsInfo) {
            int  a=partService.addPart(partsInfo);
            return a;
    }
}
package com.lzm.controller.admin;
 
import com.lzm.pojo.CarInfo;
import com.lzm.pojo.PartsInfo;
import com.lzm.pojo.PurchaseInfo;
import com.lzm.pojo.UserInfo;
import com.lzm.service.Interface.PartService;
import com.lzm.service.Interface.PurchaseService;
import com.lzm.utils.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
/**
 * @author znz
 * @create 2021- 03- 31- 15:55
 */
@Controller
public class PurchaseController {
    @Autowired
    private PurchaseService purchaseService;
    @Autowired
    private PartService partService;
 
    @RequestMapping(value="/ShowAllPurchase.action",method = RequestMethod.GET)
    @ResponseBody
    public PageResult<List<PurchaseInfo>> ShowAllPurchase(@RequestParam(value = "page") int page , int limit) {
        List<PurchaseInfo> purchaseInfos = purchaseService.selectAllPurchase(page,limit);
        System.out.println(purchaseInfos.toString());
        //返回的总记录数
        int count=purchaseService.findPurchasePageCount();
        PageResult<List<PurchaseInfo>> listPageResult=new PageResult<List<PurchaseInfo>>("",purchaseInfos,0,count);
        return listPageResult;
 
    }
 
    @RequestMapping(value="/selectPurchaseByPartName.action",method = RequestMethod.GET)
    @ResponseBody
    public PageResult<List<PurchaseInfo>> selectPurchaseByPartName(@RequestParam(value = "page") int page , int limit, String plate) {
        List<PurchaseInfo> purchaseInfos = purchaseService.selectPurchaseByPartName(plate);
        //返回的总记录数
        int count=purchaseInfos.size();
        PageResult<List<PurchaseInfo>> listPageResult=new PageResult<List<PurchaseInfo>>("",purchaseInfos,0,count);
        return listPageResult;
    }
 
    @RequestMapping(value="/AddPurchase.action",method = RequestMethod.POST)
    @ResponseBody
    public int addPurchase(@RequestBody PurchaseInfo purchaseInfo) {
        int  a=purchaseService.addPurchase(purchaseInfo);
            return a;
 
    }
}
package com.lzm.controller.admin;
 
import com.lzm.conversion.DateConveter;
import com.lzm.pojo.UserInfo;
import com.lzm.service.Interface.UserService;
import com.lzm.utils.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpSession;
import java.util.List;
 
/**
 * @author znz
 * @create 2021- 03- 26- 12:11
 */
@Controller
public class UserController {
    @Autowired
    private UserService userService;
    @Autowired
    private DateConveter dateConveter;
 
    @RequestMapping(value="/ShowAllUser.action",method = RequestMethod.GET)
    @ResponseBody
    public PageResult<List<UserInfo>> ShowAllUser(@RequestParam(value = "page") int page , int limit) {
        List<UserInfo> users = userService.selectAllUser(page,limit);
        //返回的总记录数
        int count=userService.findUserPageCount();
        PageResult<List<UserInfo>> listPageResult=new PageResult<List<UserInfo>>("",users,0,count);
        return listPageResult;
 
    }
 
    @RequestMapping(value="/selectUserByPhone.action",method = RequestMethod.GET)
    @ResponseBody
    public PageResult<List<UserInfo>> selectUserByPhone(@RequestParam(value = "page") int page , int limit,String phone) {
 
        System.out.println(phone);
        List<UserInfo> users = userService.selectUserByPhone(phone);
        PageResult<List<UserInfo>> listPageResult=new PageResult<List<UserInfo>>("",users,0,1);
        return listPageResult;
    }
 
    @RequestMapping(value="/updateUser.action",method = RequestMethod.POST)
    @ResponseBody
    public UserInfo updateUser(HttpSession session, @RequestBody UserInfo user) {
 
        //判断密码是否改变
        int a=userService.isChangePasswod(user);
        if (a==0)
        {
            user=userService.updateUser(user);
            UserInfo user1 = (UserInfo) session.getAttribute("user");
            if (user.getId()==user1.getId())
            {
                session.setAttribute("user",user1);
            }
            return user;
        }else {
            String    password= DigestUtils.md5DigestAsHex(user.getPassword().getBytes());
            user.setPassword(password);
            user=userService.updateUser(user);
            UserInfo user1 = (UserInfo) session.getAttribute("user");
            if (user.getId()==user1.getId())
            {
                session.setAttribute("user",user1);
            }
            return user;
        }
    }
 
    //根据ID删除用户
    @RequestMapping(value="/deleteUser.action",method = RequestMethod.GET)
    @ResponseBody
    public int deleteUser(int id) {
        int a=userService.deleteUserByID(id);
        return a;
    }
 
 
    @RequestMapping(value="/AddUser.action",method = RequestMethod.POST)
    @ResponseBody
    public int AddUser(@RequestBody UserInfo user) {
        if (userService.selectUserByPhone(user.getPhone()).size()>0)
        {
            return 2;
        }else
        {
            //2:手机号重复  1:添加成功
            String    password= DigestUtils.md5DigestAsHex(user.getPassword().getBytes());
            int  a=userService.addUser(user);
            return a;
        }
    }
}

到此这篇关于使用SSM+Layui+Bootstrap实现汽车维保系统的示例代码的文章就介绍到这了,更多相关SSM+Layui+Bootstrap汽车维保系统内容请搜索云海天教程以前的文章或继续浏览下面的相关文章希望大家以后多多支持云海天教程!