SSM框架(spring+springmvc+mabatis)+Mysql实现的车辆理赔系统(角色分为普通用户、勘察员、管理员,包含普通用户维护个人车辆保险、申请理赔、勘察员勘察、管理员管等)

@

SSM框架(spring+springmvc+mabatis)+Mysql实现的车辆理赔系统

本系统为了车辆理赔的流程管理,将三个角色分开,普通用户、工作人员、管理员三端,普通用户进行车辆保险增加维护、申请理赔、查看勘察记录、调查记录,勘察员进行勘察录入导出、管理员进行用户管理、理赔流程审批等,大大提高了理赔的效率。

实现功能截图

登录:
请添加图片描述
普通用户:
个人资料
请添加图片描述
个人账户
请添加图片描述
我的保险列表
请添加图片描述
增加保险
请添加图片描述
我的理赔列表
请添加图片描述
申请理赔
请添加图片描述
调查记录查看
请添加图片描述
勘察记录查看
请添加图片描述
勘察员
事故案件调查_待调查事故保单列表维护
请添加图片描述
待调查保单列表导出、打印
请添加图片描述
已调查记录列表
请添加图片描述
现场勘察管理——勘察记录列表
请添加图片描述
管理员
用户列表编辑、删除、身份查看
请添加图片描述

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
审核保单申请——申请理赔列表、通过或驳回操作
请添加图片描述
请添加图片描述
系统公告
请添加图片描述
系统刷新
请添加图片描述

系统功能

本车险理赔管理系统实现了以下功能:
1、登录、注册
2、系统公告
3、个人中心
4、系统刷新
分为三个角色,分别有以下功能
普通用户:
5、个人账户信息
6、我的保险(保险增删改查、打印导出)
7、我的理赔
8、申请理赔
9、调查记录查看
10、勘察记录查看
勘察员:
11、事故案件调查_待调查事故保单列表维护
12、事故案件调查_已调查事故保单列表维护
13、现场勘察管理
管理员:
14、用户列表管理(身份查看、增删改查维护)
15、审核保单申请审批
16、赔偿金发放

使用技术

数据库:mysql
开发工具:Idea(Myeclispe、Eclipse也可以)
知识点:SSM框架(spring+springmvc+mabatis)

代码

实体类
Insurance.java

package com.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 公众号:程序猿矛盾体
 * 微信:Code2Life2
 */
/* 读取表结构信息 */
public class Insurance extends BaseEntity{
    
    public Insurance() {

    }
    
    /* 序号  */
    private String id;
    /* 名称  */
    private String name;
    /* 价格  */
    private BigDecimal price;
    /* 投保车辆  */
    private String car;
    /* 车牌号  */
    private String carNo;
    /* 购买时间  */
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")        
    private Date createDate;
    /* 到期时间  */
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")        
    private Date endDate;
    private String userId;
    private String color;
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date carDate;

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getId() {
        return this.id;
    }
    public String getName() {
        return this.name;
    }
    public BigDecimal getPrice() {
        return this.price;
    }
    public String getCar() {
        return this.car;
    }
    public String getCarNo() {
        return this.carNo;
    }
    public Date getCreateDate() {
        return this.createDate;
    }
    public Date getEndDate() {
        return this.endDate;
    }
   
    public void setId(String id) {
        this.id = id;
    }
    public void setName(String name) {
        this.name = name;
    }
    public void setPrice(BigDecimal price) {
        this.price = price;
    }
    public void setCar(String car) {
        this.car = car;
    }
    public void setCarNo(String carNo) {
        this.carNo = carNo;
    }
    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }
    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public Date getCarDate() {
        return carDate;
    }

    public void setCarDate(Date carDate) {
        this.carDate = carDate;
    }
}

Orders.java

package com.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
/**
 * 公众号:程序猿矛盾体
 * 微信:Code2Life2
 */
/* 读取表结构信息 */
public class Orders extends BaseEntity{
    
    public Orders() {

    }
    
    /* 序号  */
    private String id;
    /* 理赔人  */
    private String userId;
    /* 赔偿金额  */
    private BigDecimal price;
    /* 申请时间  */
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")        
    private Date createDate;
    /* 保单  */
    private String insuranceId;
    /* 车险车辆  */
    private String carNo;
    /* 描述  */
    private String description;
    /* 状态  */
    private Integer state;
    
    public String getId() {
        return this.id;
    }
    public String getUserId() {
        return this.userId;
    }
    public BigDecimal getPrice() {
        return this.price;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String getInsuranceId() {
        return this.insuranceId;
    }
    public String getCarNo() {
        return this.carNo;
    }
    public String getDescription() {
        return this.description;
    }
    public Integer getState() {
        return this.state;
    }
   
    public void setId(String id) {
        this.id = id;
    }
    public void setUserId(String userId) {
        this.userId = userId;
    }
    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public void setInsuranceId(String insuranceId) {
        this.insuranceId = insuranceId;
    }
    public void setCarNo(String carNo) {
        this.carNo = carNo;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public void setState(Integer state) {
        this.state = state;
    }
  
}

service
InsuranceService.java

package com.service;

import com.entity.Insurance;
import org.springframework.beans.factory.annotation.Autowired;
import com.dao.InsuranceDao;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.InitializingBean;
/**
 * 公众号:程序猿矛盾体
 * 微信:Code2Life2
 */
@Service
public class InsuranceService extends BaseService<Insurance,String> implements InitializingBean {
    
    @Autowired
    private InsuranceDao insuranceDao;



    public void afterPropertiesSet() throws Exception {
        super.baseDao =  insuranceDao;;
    }

    
}

OrdersService.java

package com.service;

import com.entity.Orders;
import org.springframework.beans.factory.annotation.Autowired;
import com.dao.OrdersDao;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.InitializingBean;
/**
 * 公众号:程序猿矛盾体
 * 微信:Code2Life2
 */
@Service
public class OrdersService extends BaseService<Orders,String> implements InitializingBean {
    
    @Autowired
    private OrdersDao ordersDao;



    public void afterPropertiesSet() throws Exception {
        super.baseDao =  ordersDao;;
    }

    
}

controller层
AdminInsuranceController.java

package com.controller;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.InitializingBean;
import com.entity.Insurance;
import com.service.InsuranceService;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

import com.entity.Result;
import com.utils.ResultUtil;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;

import com.entity.User;

import java.util.Date;

import com.github.pagehelper.PageHelper;
import org.springframework.web.bind.annotation.RequestParam;
import com.github.pagehelper.PageInfo;
/**
 * 公众号:程序猿矛盾体
 * 微信:Code2Life2
 */
@Controller
@RequestMapping(value = "/admin/insurance")
public class AdminInsuranceController extends BaseController {

    @Autowired
    private InsuranceService insuranceService;


    @RequestMapping("add")
    public String add(HttpServletRequest request, Insurance model) {

        request.setAttribute("model", model);
        return "/admin/insurance-add";
    }


    @RequestMapping("edit")
    public String edit(HttpServletRequest request, String id) {
        Insurance model = insuranceService.getModel(id);
        request.setAttribute("model", model);
        return "/admin/insurance-add";
    }

    @RequestMapping("save")
    @ResponseBody
    public Result save(HttpServletRequest request, Insurance model) {
        User user = (User) request.getSession().getAttribute("user");
        int i = 0;
        if (StringUtils.isBlank(model.getId())) {
            model.preInsert();
            model.setCreateDate(new Date());
            model.setUserId(user.getId());
            i = insuranceService.insertModel(model);
        } else {
            i = insuranceService.updateModel(model);
        }
        if (i == 0) {
            return ResultUtil.error("失败");
        } else {
            return ResultUtil.success(null);
        }

    }


    //删除批量删除
    @RequestMapping("delete")
    @ResponseBody
    public Result delete(HttpServletRequest request, String id) {

        if (StringUtils.isNotBlank(id)) {
            String[] split = id.split(",");
            for (int i = 0; i < split.length; i++) {
                insuranceService.deleteModel(split[i]);
            }
            return ResultUtil.success();
        } else {
            return ResultUtil.error("未选中删除项!");
        }

    }


    @RequestMapping("list")
    public String list(HttpServletRequest request, Insurance model) {

        request.setAttribute("model", model);
        return "/admin/insurance-list";
    }

    //获取列表数据
    @RequestMapping("list/data")
    @ResponseBody
    public Result list(HttpServletRequest request, Insurance model, @RequestParam(defaultValue = "1") Integer page, Integer limit) {
        User user = (User) request.getSession().getAttribute("user");
        if (user.getType() == 0){
            model.setUserId(user.getId());
        }
        PageHelper.startPage(page, limit);
        List<Insurance> list = insuranceService.getModelList(putEntityInMap(model));
        PageInfo<Insurance> pageInfo = new PageInfo<>(list);
        return ResultUtil.success(list, pageInfo.getTotal());
    }


}

AdminOrdersController.java

package com.controller;

import com.entity.Insurance;
import com.service.InsuranceService;
import com.service.UserService;
import com.utils.MapUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.InitializingBean;
import com.entity.Orders;
import com.service.OrdersService;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.List;

import com.entity.Result;
import com.utils.ResultUtil;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;

import com.entity.User;

import java.util.Date;

import com.github.pagehelper.PageHelper;
import org.springframework.web.bind.annotation.RequestParam;
import com.github.pagehelper.PageInfo;
/**
 * 公众号:程序猿矛盾体
 * 微信:Code2Life2
 */
@Controller
@RequestMapping(value = "/admin/orders")
public class AdminOrdersController extends BaseController {

    @Autowired
    private OrdersService ordersService;
    @Autowired
    private InsuranceService insuranceService;
    @Autowired
    private UserService userService;


    @RequestMapping("add")
    public String add(HttpServletRequest request, Orders model) {
        User user = (User) request.getSession().getAttribute("user");
        List<Insurance> insuranceList = insuranceService.getModelList(MapUtil.buildMap("userId", user.getId()));
        request.setAttribute("model", model);
        request.setAttribute("insuranceList", insuranceList);
        return "/admin/orders-add";
    }


    @RequestMapping("edit")
    public String edit(HttpServletRequest request, String id) {
        Orders model = ordersService.getModel(id);
        request.setAttribute("model", model);
        return "/admin/orders-add";
    }

    @RequestMapping("save")
    @ResponseBody
    public Result save(HttpServletRequest request, Orders model) {
        User user = (User) request.getSession().getAttribute("user");
        int i = 0;
        if (StringUtils.isBlank(model.getId())) {
            model.preInsert();
            model.setCreateDate(new Date());
            i = ordersService.insertModel(model);
        } else {
            i = ordersService.updateModel(model);
        }
        if (i == 0) {
            return ResultUtil.error("失败");
        } else {
            return ResultUtil.success(null);
        }

    }

    @RequestMapping("approved")
    @ResponseBody
    public Result approved(String id,Integer state){
        Orders model = ordersService.getModel(id);
        model.setState(state);
        if (state == 5){
            getMoney(id);
        }
        int i = ordersService.updateModel(model);
        if (i == 0) {
            return ResultUtil.error("失败");
        } else {
            return ResultUtil.success(null);
        }
    }

    /**
     * 发放赔偿金
     */
    public void getMoney(String orderId){
        Orders orders = ordersService.getModel(orderId);//获取保单
        User user = userService.getModel(orders.getUserId());//获取用户
        BigDecimal price = orders.getPrice();//保单申请金额
        user.setMoney(user.getMoney().add(price));//用户账户余额增加保费
        userService.updateModel(user);
    }


    //删除批量删除
    @RequestMapping("delete")
    @ResponseBody
    public Result delete(HttpServletRequest request, String id) {

        if (StringUtils.isNotBlank(id)) {
            String[] split = id.split(",");
            for (int i = 0; i < split.length; i++) {
                ordersService.deleteModel(split[i]);
            }
            return ResultUtil.success();
        } else {
            return ResultUtil.error("未选中删除项!");
        }

    }


    @RequestMapping("list")
    public String list(HttpServletRequest request, Orders model) {

        request.setAttribute("model", model);
        return "/admin/orders-list";
    }

    /**
     * 用户提交的申请理赔
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("approve")
    public String approve(HttpServletRequest request, Orders model) {

        request.setAttribute("model", model);
        return "/admin/orders-approve";
    }


    /**
     * 已经有调查勘察记录的申请单,确认是否发放赔偿金
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("money/give")
    public String moneyGive(HttpServletRequest request, Orders model) {

        request.setAttribute("model", model);
        return "/admin/orders-money";
    }

    /**
     * 用户提交的需要调查的
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("investigation")
    public String investigation(HttpServletRequest request, Orders model) {

        request.setAttribute("model", model);
        return "/admin/orders-investigation";
    }
    /**
     * 用户提交的需要调查的
     * @param request
     * @param model
     * @return
     */
    @RequestMapping("responsibility")
    public String responsibility(HttpServletRequest request, Orders model) {

        request.setAttribute("model", model);
        return "/admin/orders-responsibility";
    }



    //获取列表数据
    @RequestMapping("list/data")
    @ResponseBody
    public Result list(HttpServletRequest request, Orders model, @RequestParam(defaultValue = "1") Integer page, Integer limit) {
        PageHelper.startPage(page, limit);
        List<Orders> list = ordersService.getModelList(putEntityInMap(model));
        PageInfo<Orders> pageInfo = new PageInfo<>(list);
        return ResultUtil.success(list, pageInfo.getTotal());
    }


}

写在最后

(代码由于太多贴不全,如果有问题或者需要所有源码,可以加博主V交流: Code2Life2)

posted @ 2022-07-24 16:18  武红明  阅读(126)  评论(0编辑  收藏  举报