Java项目:198Springboot + vue实现的合同管理系统(含论文+任务书)

本文档详细描述了一个基于Springboot和Vue的合同管理系统,涉及用户管理、权限控制、数据管理、公告发布等功能,提供后端接口及使用说明,适合Java学习者作为项目实战练习或毕设参考。
摘要由CSDN通过智能技术生成
作者主页:夜未央5788

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

基于Springboot + vue实现的合同管理系统

系统包含用户和管理员两个角色

管理员:
用户管理:管理用户注册、登录、权限设置等,确保系统用户的安全性和合规性。
基础数据管理:维护部门、职位、角色等基础数据,确保数据的准确性和一致性。
公告信息管理:发布与合同管理相关的通知、公告和更新信息,促进信息共享和传播。
留言管理:查看并处理用户的留言,解决用户的问题、收集反馈意见。
轮播图信息管理:设置和更新前台门户的轮播图,展示重要的合同信息、公告或宣传内容。
合同管理:负责合同的起草、审批、签订、执行、归档等全生命周期管理。
客户管理:记录和管理与合同相关的客户信息,包括客户的基本资料、历史合同记录等。

用户:
前台门户浏览:通过前台门户了解合同管理系统的功能和操作。
个人信息管理:查看和编辑自己的基本资料。
合同查看与操作:根据权限查看与自己相关的合同信息,执行合同操作(如签署、查看进度等)。
留言功能:在系统中留言,提出疑问、建议或反馈意见。
公告信息查看:查看系统发布的公告信息,了解合同管理相关通知和更新。

使用人群:
正在做毕设的学生,或者需要项目实战练习的Java学习者

由于本程序规模不大,可供课程设计,毕业设计学习演示之用

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 
4.数据库:MySql 5.7/8.0版本均可;

5.是否Maven项目:是;

技术栈

后端:SpringBoot+Mybaits

前端:Vue + elementui

使用说明

项目运行:
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入地址:
前台地址:
http://localhost:8080/baoxianhetong/front/index.html
用户账户:a1 密码:123456

后台登录页面
http://localhost:8080/baoxianhetong/admin/dist/index.html
管理员账户:admin 密码:admin
用户账户:a1 密码:123456
 

注意项目文件路径中不能含有中文、空格、特殊字符等,否则图片会上传不成功。

运行截图

论文

前台界面

后台界面

相关代码

HetongController


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("/hetong")
public class HetongController {
    private static final Logger logger = LoggerFactory.getLogger(HetongController.class);

    @Autowired
    private HetongService hetongService;


    @Autowired
    private TokenService tokenService;
    @Autowired
    private DictionaryService dictionaryService;

    //级联表service
    @Autowired
    private KehuService kehuService;
    @Autowired
    private YonghuService yonghuService;



    /**
    * 后端列表
    */
    @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(StringUtil.isEmpty(role))
            return R.error(511,"权限为空");
        else if("用户".equals(role))
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        if(params.get("orderBy")==null || params.get("orderBy")==""){
            params.put("orderBy","id");
        }
        PageUtils page = hetongService.queryPage(params);

        //字典表数据转换
        List<HetongView> list =(List<HetongView>)page.getList();
        for(HetongView 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);
        HetongEntity hetong = hetongService.selectById(id);
        if(hetong !=null){
            //entity转view
            HetongView view = new HetongView();
            BeanUtils.copyProperties( hetong , view );//把实体数据重构到view中

                //级联表
                KehuEntity kehu = kehuService.selectById(hetong.getKehuId());
                if(kehu != null){
                    BeanUtils.copyProperties( kehu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setKehuId(kehu.getId());
                }
                //级联表
                YonghuEntity yonghu = yonghuService.selectById(hetong.getYonghuId());
                if(yonghu != null){
                    BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setYonghuId(yonghu.getId());
                }
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

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

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(StringUtil.isEmpty(role))
            return R.error(511,"权限为空");
        else if("用户".equals(role))
            hetong.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));

        Wrapper<HetongEntity> queryWrapper = new EntityWrapper<HetongEntity>()
            .eq("yonghu_id", hetong.getYonghuId())
            .eq("kehu_id", hetong.getKehuId())
            .eq("hetong_uuid_number", hetong.getHetongUuidNumber())
            .eq("hetong_types", hetong.getHetongTypes())
            .eq("changduan_types", hetong.getChangduanTypes())
            .eq("shouyiren_name", hetong.getShouyirenName())
            .eq("shouyiren_phone", hetong.getShouyirenPhone())
            .eq("shouyiren_id_number", hetong.getShouyirenIdNumber())
            .eq("shouyiren_address", hetong.getShouyirenAddress())
            .eq("zhixing_time", new SimpleDateFormat("yyyy-MM-dd").format(hetong.getZhixingTime()))
            .eq("daoqi_time", new SimpleDateFormat("yyyy-MM-dd").format(hetong.getDaoqiTime()))
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        HetongEntity hetongEntity = hetongService.selectOne(queryWrapper);
        if(hetongEntity==null){
            hetong.setInsertTime(new Date());
            hetong.setCreateTime(new Date());
            hetongService.insert(hetong);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody HetongEntity hetong, HttpServletRequest request){
        logger.debug("update方法:,,Controller:{},,hetong:{}",this.getClass().getName(),hetong.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(StringUtil.isEmpty(role))
//            return R.error(511,"权限为空");
//        else if("用户".equals(role))
//            hetong.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
        //根据字段查询是否有相同数据
        Wrapper<HetongEntity> queryWrapper = new EntityWrapper<HetongEntity>()
            .notIn("id",hetong.getId())
            .andNew()
            .eq("yonghu_id", hetong.getYonghuId())
            .eq("kehu_id", hetong.getKehuId())
            .eq("hetong_uuid_number", hetong.getHetongUuidNumber())
            .eq("hetong_types", hetong.getHetongTypes())
            .eq("changduan_types", hetong.getChangduanTypes())
            .eq("shouyiren_name", hetong.getShouyirenName())
            .eq("shouyiren_phone", hetong.getShouyirenPhone())
            .eq("shouyiren_id_number", hetong.getShouyirenIdNumber())
            .eq("shouyiren_address", hetong.getShouyirenAddress())
            .eq("zhixing_time", new SimpleDateFormat("yyyy-MM-dd").format(hetong.getZhixingTime()))
            .eq("daoqi_time", new SimpleDateFormat("yyyy-MM-dd").format(hetong.getDaoqiTime()))
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        HetongEntity hetongEntity = hetongService.selectOne(queryWrapper);
        if("".equals(hetong.getHetongFile()) || "null".equals(hetong.getHetongFile())){
                hetong.setHetongFile(null);
        }
        if(hetongEntity==null){
            //  String role = String.valueOf(request.getSession().getAttribute("role"));
            //  if("".equals(role)){
            //      hetong.set
            //  }
            hetongService.updateById(hetong);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        hetongService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        try {
            List<HetongEntity> hetongList = 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){
                            //循环
                            HetongEntity hetongEntity = new HetongEntity();
//                            hetongEntity.setYonghuId(Integer.valueOf(data.get(0)));   //用户 要改的
//                            hetongEntity.setKehuId(Integer.valueOf(data.get(0)));   //投保人 要改的
//                            hetongEntity.setHetongUuidNumber(data.get(0));                    //合同唯一编号 要改的
//                            hetongEntity.setHetongTypes(Integer.valueOf(data.get(0)));   //保险合同类型 要改的
//                            hetongEntity.setChangduanTypes(Integer.valueOf(data.get(0)));   //长短类型 要改的
//                            hetongEntity.setHetongFile(data.get(0));                    //合同文件 要改的
//                            hetongEntity.setBaofeiDouble(data.get(0));                    //保费 要改的
//                            hetongEntity.setBaoeDouble(data.get(0));                    //保额 要改的
//                            hetongEntity.setShouyirenName(data.get(0));                    //受益人姓名 要改的
//                            hetongEntity.setShouyirenPhone(data.get(0));                    //受益人手机号 要改的
//                            hetongEntity.setShouyirenIdNumber(data.get(0));                    //受益人身份证号 要改的
//                            hetongEntity.setShouyirenAddress(data.get(0));                    //受益人地址 要改的
//                            hetongEntity.setHetongContent("");//照片
//                            hetongEntity.setZhixingTime(new Date(data.get(0)));          //执行日期 要改的
//                            hetongEntity.setDaoqiTime(new Date(data.get(0)));          //到期日期 要改的
//                            hetongEntity.setInsertTime(date);//时间
//                            hetongEntity.setCreateTime(date);//时间
                            hetongList.add(hetongEntity);


                            //把要查询是否重复的字段放入map中
                                //合同唯一编号
                                if(seachFields.containsKey("hetongUuidNumber")){
                                    List<String> hetongUuidNumber = seachFields.get("hetongUuidNumber");
                                    hetongUuidNumber.add(data.get(0));//要改的
                                }else{
                                    List<String> hetongUuidNumber = new ArrayList<>();
                                    hetongUuidNumber.add(data.get(0));//要改的
                                    seachFields.put("hetongUuidNumber",hetongUuidNumber);
                                }
                        }

                        //查询是否重复
                         //合同唯一编号
                        List<HetongEntity> hetongEntities_hetongUuidNumber = hetongService.selectList(new EntityWrapper<HetongEntity>().in("hetong_uuid_number", seachFields.get("hetongUuidNumber")));
                        if(hetongEntities_hetongUuidNumber.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(HetongEntity s:hetongEntities_hetongUuidNumber){
                                repeatFields.add(s.getHetongUuidNumber());
                            }
                            return R.error(511,"数据库的该表中的 [合同唯一编号] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                        hetongService.insertBatch(hetongList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }





    /**
    * 前端列表
    */
    @IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

        // 没有指定排序字段就默认id倒序
        if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
            params.put("orderBy","id");
        }
        PageUtils page = hetongService.queryPage(params);

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

    /**
    * 前端详情
    */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        HetongEntity hetong = hetongService.selectById(id);
            if(hetong !=null){


                //entity转view
                HetongView view = new HetongView();
                BeanUtils.copyProperties( hetong , view );//把实体数据重构到view中

                //级联表
                    KehuEntity kehu = kehuService.selectById(hetong.getKehuId());
                if(kehu != null){
                    BeanUtils.copyProperties( kehu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setKehuId(kehu.getId());
                }
                //级联表
                    YonghuEntity yonghu = yonghuService.selectById(hetong.getYonghuId());
                if(yonghu != null){
                    BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setYonghuId(yonghu.getId());
                }
                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view, request);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody HetongEntity hetong, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,hetong:{}",this.getClass().getName(),hetong.toString());
        Wrapper<HetongEntity> queryWrapper = new EntityWrapper<HetongEntity>()
            .eq("yonghu_id", hetong.getYonghuId())
            .eq("kehu_id", hetong.getKehuId())
            .eq("hetong_uuid_number", hetong.getHetongUuidNumber())
            .eq("hetong_types", hetong.getHetongTypes())
            .eq("changduan_types", hetong.getChangduanTypes())
            .eq("shouyiren_name", hetong.getShouyirenName())
            .eq("shouyiren_phone", hetong.getShouyirenPhone())
            .eq("shouyiren_id_number", hetong.getShouyirenIdNumber())
            .eq("shouyiren_address", hetong.getShouyirenAddress())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        HetongEntity hetongEntity = hetongService.selectOne(queryWrapper);
        if(hetongEntity==null){
            hetong.setInsertTime(new Date());
            hetong.setCreateTime(new Date());
        //  String role = String.valueOf(request.getSession().getAttribute("role"));
        //  if("".equals(role)){
        //      hetong.set
        //  }
        hetongService.insert(hetong);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }


}

如果也想学习本系统,下面领取。关注并回复:198springboot

  • 8
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夜未央5788

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值