汽车维修管理系统(RPMS)项目

汽车维修管理项目

系统简称(RPMS) – Repair Managerment System

主要功能内容有:

汽车维修管理系统(RPMS) 服务于4S接待人员,维修人员,结算人员,售后人员,已经维修车辆客户的;
接待人员负责接待来维修的车辆的用户,根据客户的要求或者维修人员的说明,填写维修单,
维修人员负责专门进行车辆的维修,维修完毕之后,通知结算人员负责维修费用的结算,结算完成之后通知售后人员按照用户的线路进行还车业务;
用户可以随时动态的查询自己维修的车辆的情况;

项目大体模块

汽车维修管理系统(RPMS)项目_第1张图片

一.基础数据维护以及权限模块:

维修人员管理(CRUD)
结算方式(支付方式CRUD)管理
管理人员维护(CRUD)
资源管理
权限管理
角色管理
菜单管理

二.维修工单模块

一对多关系,一个主单涉及多个明细单
维修工单主单的生成(CRUD)
维修明细单的生成(CRUD)
维修工单的高级查询操作

仨.结算工单和还车模块

结算单生成
结算单取消
结算单外部查询工作(webservice-cxf)
还车模型生产百度还车线路图(百度地图)

四.登录管理模块

用户普通登录
用户第三方登录 (QQ 微信 微博 任选其中之一)
用户注册
用户注销
用户验证码
记住用户名和密码

五.配件管理模块

负责配件的CRUD
负责配件入库添加luence
负责配件高级查询操作

负责项目的(结算工单管理)模块

一.模块的具体需求和功能

当维修人员维修车辆完成之后,交互给结算人员,由结算人员填写结算单据,通知客户进行付款操作;

车辆维修完毕之后,由结算人员填写结算单据,进行车辆的结算。结算之后,更新维修工单状态;

二.大体需要数据库相关的内容

汽车维修管理系统(RPMS)项目_第2张图片

(实际在设计中还加入了一些其他功能性字段)

汽车维修管理系统(RPMS)项目_第3张图片

Day_1(完成项目框架的构建,和新建数据库相关的表)

整体项目使用框架ssm(springmvc+spring+mabtis)

整个项目框架

汽车维修管理系统(RPMS)项目_第4张图片
在各个模块中有需要引用的包必须在pox添加依赖:如


        
        
            com.rpms.iteam
            rpms-mapper
            1.0
        
        
        
            com.rpms.iteam
            rpms-beans
            1.0
        
        
        
            org.apache.velocity
            velocity-engine-core
            2.0
        
        .......................................
    
在service中的applicationContext.xml文件需要引入mapper(controller层同理)

在这里插入图片描述

二.抽取公共的父类和工具类

mapper(dao)

public interface BaseMapper {

    int deleteByPrimaryKey(Long id);

    int insert(T t);

    T selectByPrimaryKey(Long id);

    List selectAll();

    int updateByPrimaryKey(T t);
}

BaseQuery

public class BaseQuery {
    private String q;//关键字

    private int page = 0;//页数
    private int rows = 10;//每页的条目数

    public String getQ() {
        return q;
    }

    public void setQ(String q) {
        this.q = q;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getRows() {
        return rows;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }

}

分页pageList

public class PageList {

    private Long total;//总页数
    //每页数据
    private List rows  = new ArrayList<>();
    
    ......get/set

三.使用velocity/easycode代码生成技术

生成相应的mapper/domain/service/controller/js/jsp文件(完成基本的CRUD)
velocity生成代码
package com.rpms.iteam.velocity;

import com.rpms.iteam.utils.EasyuiColumn;
import com.rpms.iteam.utils.FieldVo;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

/**
 * @Author: zytest
 * @Date: 2019/1/18 23:50
 * @Version 1.0
 */
public class VelocityMain {
    //模板文件数组定义:顺序是你自己的
    /*static String[] templateName = {
            "domain.js", "domain.jsp", "DomainController.java"
            , "DomainQuery.java", "DomainServiceImpl.java", "IDomainService.java"
    };*/
    //模板名称
    static String[] templateName = {
            "domain.js", "domain.jsp","DomainController.java","DomainQuery.java","DomainServiceImpl.java","IDomainService.java"
    };

    //项目路径:
    static final String jsFilePath = "C:\\Users\\hp\\Desktop\\rpms\\rpms-web\\src\\main\\webapp\\static\\js\\";
    static final String jspFilePath = "C:\\Users\\hp\\Desktop\\rpms\\rpms-web\\src\\main\\webapp\\WEB-INF\\views\\";
    static final String controllerFilePath = "C:\\Users\\hp\\Desktop\\rpms\\rpms-web\\src\\main\\java\\com\\rpms\\iteam\\web\\controller\\";
    static final String queryFilePath = "C:\\Users\\hp\\Desktop\\rpms\\base-core\\src\\main\\java\\com\\rpms\\iteam\\query\\";
//    static final String serviceImplFilePath = "F:\\opensource\\ideaWork\\itsource-parent\\crm-service\\src\\main\\java\\cn\\itsource\\crm\\service\\impl\\";
//    static final String serviceFilePath = "F:\\opensource\\ideaWork\\itsource-parent\\crm-service\\src\\main\\java\\cn\\itsource\\crm\\service\\";

    //生成文件的路径数据定义:这个要和templateName对应起来
    static String[] outFileRootPath = {
            jsFilePath, jspFilePath, controllerFilePath, queryFilePath
           /* , serviceImplFilePath,serviceFilePath*/
    };



    //可能有多个domain需要生成
    static String[] domain = {"Employee"};

    /**
     * 1:定义模板
     * 2:使用Velocity生成模板:
     * 2.1:初始化Velocity:设置加载方式:classpath下加载
     * 2.2:设置Velocity的上下文
     * 2.3:从classpath下读取模板,输出到文件
     *
     * @param args
     */
    public static void main(String[] args) throws ClassNotFoundException {
        for (String domainMame : domain) {
            // domainName = Employee

            Properties p = new Properties();
            // 2.1:初始化Velocity:设置加载方式:classpath下加载
            // 使用classpath加载:org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
            p.setProperty(Velocity.RESOURCE_LOADER, "class");
            p.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
            Velocity.init(p);

            //2.2:设置Velocity的上下文 把数据保存起来 页面在替换${domain}
            VelocityContext context = new VelocityContext();
            //  domainName = Employee
            // domainLower= employee
            //Department -->department
            String domainLower = domainMame.substring(0, 1).toLowerCase() + domainMame.substring(1);
            //使用Department代替模板文件中:Domain
            context.put("Domain", domainMame);
            context.put("domain", domainLower);
            //
            context.put("fieldList",scanDomain(domainMame));

            //遍历模板,每一个模板都生成一个文件
            for (int i=0;itempName=domain.js
                String templateFile = "template\\" + tempName;
                // templateFile=template\domain.js
                //根据模板的索引读取对应生成文件的路径:
                String outFilePath = outFileRootPath[i];
                // outFilePath=F:\java0830\itsource-parent\crm-web\src\main\webapp\static\js\

                //"D:\\workspace\ideaworkspace\\crm2_parent\\crm2-web\\src\\main\\webapp\\WEB-INF\\views\\";
                //路径里面包含views 和 js 说明jsp和js路径
                boolean views= outFilePath.contains("views")||outFilePath.contains("js");
                if(views){
                    // D:\\workspace\ideaworkspace\\crm2_parent\\crm2-web\\src\\main\\webapp\\WEB-INF\\views\\employee\\
                    outFilePath=outFilePath+"\\"+domainLower+"\\";
                }
                // outFile=outFilePath+domain.js==>outFilePath+employee.js
                String outFile = outFilePath + tempName;
                outFile=outFile.replaceAll("Domain",domainMame).replaceAll("domain",domainLower);


                try {
                    File file = new File(outFile);
                    File parentFile = file.getParentFile();
                    //文件不存在,就创建
                    if (!parentFile.exists()) {
                        parentFile.mkdirs();
                    }
                    //文件输出
                    FileWriter fileWriter = new FileWriter(file);
                    Template template = Velocity.getTemplate(templateFile, "utf-8");
                    //模板+数据--》生成页面
                    template.merge(context, fileWriter);
                    fileWriter.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
       /* List voList = scanDomain("Employee");
        for (FieldVo fieldVo : voList) {
            System.out.println(fieldVo);
        }*/
    }
    //Department
    private static List scanDomain(String domainMame) throws ClassNotFoundException {
        List voList=new ArrayList<>();
        // domainMame=Employee
        // cn.itsource.crm.domain.Department
        String clazzPath="com.rpms.iteam.domain."+domainMame;
        //拿到Class实例
        Class c = Class.forName(clazzPath);

        //获取字段
        Field[] declaredFields = c.getDeclaredFields();
        //循环字段
        for (Field declaredField : declaredFields) {
            //判断这个字段上是否有EasyuiColumn
            if(declaredField.isAnnotationPresent(EasyuiColumn.class)){
                EasyuiColumn easyuiColumn = declaredField.getAnnotation(EasyuiColumn.class);

                //获取到注解的title的值 部门名称
                String title = easyuiColumn.title();
                //取到字段 name id
                String name = declaredField.getName();

                FieldVo fieldVo=new FieldVo();

                fieldVo.setField(name);
                fieldVo.setTitle(title);

                voList.add(fieldVo);

            }
        }
        for (FieldVo fieldVo : voList) {
            System.out.println(fieldVo);
        }

        return voList;
    }
}

模板
汽车维修管理系统(RPMS)项目_第5张图片


四.项目过程中遇到的问题收集

问题一:
完成service层后对表进行基本CRUD测试出现报错,提示早不到domain层

经过检测发现,编译文件下并没有发现domain层的类被编译

解决方法:
汽车维修管理系统(RPMS)项目_第6张图片
问题二:

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.rpms.iteam.mapper.BaseMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1308)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1054)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:949)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:527)
	... 42 more
没有bean,看自己是不是哪里注入错误,Basic没有引入spring相关包,不能使用注解注入,在具体service上实现本方法, 修改为解决 protected abstract BaseMapper baseMapper();

汽车维修管理系统(RPMS)项目_第7张图片

你可能感兴趣的:(汽车维修管理系统(RPMS)项目)