基于java+springboot+vue的人事管理系统

项目介绍

传统信息的管理大部分依赖于管理人员的手工登记与管理,然而,随着近些年信息技术的迅猛发展,让许多比较老套的信息管理模式进行了更新迭代,问卷信息因为其管理内容繁杂,管理数量繁多导致手工进行处理不能满足广大用户的需求,因此就应运而生出相应的人事管理系统。

本人事管理系统分为管理员还有用户两个权限,管理员可以管理用户的基本信息内容,可以管理公告信息以及公告的租赁信息,能够与用户进行相互交流等操作,用户可以查看问卷信息,可以查看公告以及查看管理员回复信息等操作。

该人事管理系统采用的是WEB应用程序开发中最受欢迎的B/S三层结构模式,使用占用空间小但功能齐全的MySQL数据库进行数据的存储操作,系统开发技术使用到了Vue技术。该人事管理系统能够解决许多传统手工操作的难题,比如数据查询耽误时间长,数据管理步骤繁琐等问题。总的来说,人事管理系统性能稳定,功能较全,投入运行使用性价比很高。

在这里插入图片描述

开发环境

编程语言:Java
数据库 :Mysql
系统架构:B/S
后端框架:SpringBoot
编译工具:idea或者eclipse,jdk1.8,maven
支持定做:java/php/python/android/小程序vue/爬虫/c#/asp.net

系统实现

5.1 管理员功能模块的实现
5.1.1 问卷列表
如图5.1显示的就是问卷列表页面,此页面提供给管理员的功能有:查看问卷、新增问卷、修改问卷、删除问卷等。
在这里插入图片描述

图5.1 问卷列表页面

5.1.2 公告信息管理
管理员可以对公告信息进行管理,可以新增公告信息,修改公告信息,删除无效的公告信息。公告信息管理界面如图5.2所示。
在这里插入图片描述

图5.2 公告信息管理页面

5.1.3 公告类型管理
公告类型管理页面显示所有公告类型,在此页面既可以让管理员添加新的公告信息类型,也能对已有的公告类型信息执行编辑更新,失效的公告类型信息也能让管理员快速删除。下图就是公告类型管理页面。公告类型管理界面如图5.3所示。
在这里插入图片描述

图5.3公告类型管理界面

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

核心代码

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

    @Autowired
    private CaiwubaoxiaoService caiwubaoxiaoService;


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

    //级联表service
    @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(false)
            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 = caiwubaoxiaoService.queryPage(params);

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

                //级联表
                YonghuEntity yonghu = yonghuService.selectById(caiwubaoxiao.getYonghuId());
                if(yonghu != null){
                    BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到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 CaiwubaoxiaoEntity caiwubaoxiao, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,caiwubaoxiao:{}",this.getClass().getName(),caiwubaoxiao.toString());

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

        Wrapper<CaiwubaoxiaoEntity> queryWrapper = new EntityWrapper<CaiwubaoxiaoEntity>()
            .eq("yonghu_id", caiwubaoxiao.getYonghuId())
            .eq("caiwubaoxiao_uuid_number", caiwubaoxiao.getCaiwubaoxiaoUuidNumber())
            .eq("caiwubaoxiao_name", caiwubaoxiao.getCaiwubaoxiaoName())
            .eq("caiwubaoxiao_types", caiwubaoxiao.getCaiwubaoxiaoTypes())
            .eq("caiwubaoxiao_yesno_types", caiwubaoxiao.getCaiwubaoxiaoYesnoTypes())
            .eq("caiwubaoxiao_yesno_text", caiwubaoxiao.getCaiwubaoxiaoYesnoText())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        CaiwubaoxiaoEntity caiwubaoxiaoEntity = caiwubaoxiaoService.selectOne(queryWrapper);
        if(caiwubaoxiaoEntity==null){
            caiwubaoxiao.setInsertTime(new Date());
            caiwubaoxiao.setCaiwubaoxiaoYesnoTypes(1);
            caiwubaoxiao.setCreateTime(new Date());
            caiwubaoxiaoService.insert(caiwubaoxiao);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

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

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
//        else if("员工".equals(role))
//            caiwubaoxiao.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
        //根据字段查询是否有相同数据
        Wrapper<CaiwubaoxiaoEntity> queryWrapper = new EntityWrapper<CaiwubaoxiaoEntity>()
            .notIn("id",caiwubaoxiao.getId())
            .andNew()
            .eq("yonghu_id", caiwubaoxiao.getYonghuId())
            .eq("caiwubaoxiao_uuid_number", caiwubaoxiao.getCaiwubaoxiaoUuidNumber())
            .eq("caiwubaoxiao_name", caiwubaoxiao.getCaiwubaoxiaoName())
            .eq("caiwubaoxiao_types", caiwubaoxiao.getCaiwubaoxiaoTypes())
            .eq("insert_time", caiwubaoxiao.getInsertTime())
            .eq("caiwubaoxiao_yesno_types", caiwubaoxiao.getCaiwubaoxiaoYesnoTypes())
            .eq("caiwubaoxiao_yesno_text", caiwubaoxiao.getCaiwubaoxiaoYesnoText())
            .eq("caiwubaoxiao_shenhe_time", caiwubaoxiao.getCaiwubaoxiaoShenheTime())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        CaiwubaoxiaoEntity caiwubaoxiaoEntity = caiwubaoxiaoService.selectOne(queryWrapper);
        if("".equals(caiwubaoxiao.getCaiwubaoxiaoPhoto()) || "null".equals(caiwubaoxiao.getCaiwubaoxiaoPhoto())){
                caiwubaoxiao.setCaiwubaoxiaoPhoto(null);
        }
        if(caiwubaoxiaoEntity==null){
            caiwubaoxiaoService.updateById(caiwubaoxiao);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }


    /**
    * 审核
    */
    @RequestMapping("/shenhe")
    public R shenhe(@RequestBody CaiwubaoxiaoEntity caiwubaoxiaoEntity, HttpServletRequest request){
        logger.debug("shenhe方法:,,Controller:{},,caiwubaoxiaoEntity:{}",this.getClass().getName(),caiwubaoxiaoEntity.toString());

//        if(caiwubaoxiaoEntity.getCaiwubaoxiaoYesnoTypes() == 2){//通过
//            caiwubaoxiaoEntity.setCaiwubaoxiaoTypes();
//        }else if(caiwubaoxiaoEntity.getCaiwubaoxiaoYesnoTypes() == 3){//拒绝
//            caiwubaoxiaoEntity.setCaiwubaoxiaoTypes();
//        }
        caiwubaoxiaoEntity.setCaiwubaoxiaoShenheTime(new Date());//审核时间
        caiwubaoxiaoService.updateById(caiwubaoxiaoEntity);//审核
        return R.ok();
    }

    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        caiwubaoxiaoService.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<CaiwubaoxiaoEntity> caiwubaoxiaoList = 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){
                            //循环
                            CaiwubaoxiaoEntity caiwubaoxiaoEntity = new CaiwubaoxiaoEntity();
//                            caiwubaoxiaoEntity.setYonghuId(Integer.valueOf(data.get(0)));   //员工 要改的
//                            caiwubaoxiaoEntity.setCaiwubaoxiaoUuidNumber(data.get(0));                    //财务报销编号 要改的
//                            caiwubaoxiaoEntity.setCaiwubaoxiaoName(data.get(0));                    //财务报销名称 要改的
//                            caiwubaoxiaoEntity.setCaiwubaoxiaoPhoto("");//详情和图片
//                            caiwubaoxiaoEntity.setCaiwubaoxiaoTypes(Integer.valueOf(data.get(0)));   //财务报销类型 要改的
//                            caiwubaoxiaoEntity.setInsertTime(date);//时间
//                            caiwubaoxiaoEntity.setCaiwubaoxiaoContent("");//详情和图片
//                            caiwubaoxiaoEntity.setCaiwubaoxiaoYesnoTypes(Integer.valueOf(data.get(0)));   //财务报销状态 要改的
//                            caiwubaoxiaoEntity.setCaiwubaoxiaoYesnoText(data.get(0));                    //审核理由 要改的
//                            caiwubaoxiaoEntity.setCaiwubaoxiaoShenheTime(sdf.parse(data.get(0)));          //审核时间 要改的
//                            caiwubaoxiaoEntity.setCreateTime(date);//时间
                            caiwubaoxiaoList.add(caiwubaoxiaoEntity);


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

                        //查询是否重复
                         //财务报销编号
                        List<CaiwubaoxiaoEntity> caiwubaoxiaoEntities_caiwubaoxiaoUuidNumber = caiwubaoxiaoService.selectList(new EntityWrapper<CaiwubaoxiaoEntity>().in("caiwubaoxiao_uuid_number", seachFields.get("caiwubaoxiaoUuidNumber")));
                        if(caiwubaoxiaoEntities_caiwubaoxiaoUuidNumber.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(CaiwubaoxiaoEntity s:caiwubaoxiaoEntities_caiwubaoxiaoUuidNumber){
                                repeatFields.add(s.getCaiwubaoxiaoUuidNumber());
                            }
                            return R.error(511,"数据库的该表中的 [财务报销编号] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                        caiwubaoxiaoService.insertBatch(caiwubaoxiaoList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            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 = caiwubaoxiaoService.queryPage(params);

        //字典表数据转换
        List<CaiwubaoxiaoView> list =(List<CaiwubaoxiaoView>)page.getList();
        for(CaiwubaoxiaoView 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);
        CaiwubaoxiaoEntity caiwubaoxiao = caiwubaoxiaoService.selectById(id);
            if(caiwubaoxiao !=null){


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

                //级联表
                    YonghuEntity yonghu = yonghuService.selectById(caiwubaoxiao.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 CaiwubaoxiaoEntity caiwubaoxiao, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,caiwubaoxiao:{}",this.getClass().getName(),caiwubaoxiao.toString());
        Wrapper<CaiwubaoxiaoEntity> queryWrapper = new EntityWrapper<CaiwubaoxiaoEntity>()
            .eq("yonghu_id", caiwubaoxiao.getYonghuId())
            .eq("caiwubaoxiao_uuid_number", caiwubaoxiao.getCaiwubaoxiaoUuidNumber())
            .eq("caiwubaoxiao_name", caiwubaoxiao.getCaiwubaoxiaoName())
            .eq("caiwubaoxiao_types", caiwubaoxiao.getCaiwubaoxiaoTypes())
            .eq("caiwubaoxiao_yesno_types", caiwubaoxiao.getCaiwubaoxiaoYesnoTypes())
            .eq("caiwubaoxiao_yesno_text", caiwubaoxiao.getCaiwubaoxiaoYesnoText())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        CaiwubaoxiaoEntity caiwubaoxiaoEntity = caiwubaoxiaoService.selectOne(queryWrapper);
        if(caiwubaoxiaoEntity==null){
            caiwubaoxiao.setInsertTime(new Date());
            caiwubaoxiao.setCaiwubaoxiaoYesnoTypes(1);
            caiwubaoxiao.setCreateTime(new Date());
        caiwubaoxiaoService.insert(caiwubaoxiao);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }


}

论文参考

在这里插入图片描述

目 录
摘 要 I
Abstract II
目 录 III
第一章 课题背景及研究内容 1
1.1 课题背景 1
1.2 开发目的和意义 1
1.3 论文研究内容 1
第二章 相关技术 3
2.1 B/S结构 3
2.2 MySQL数据库 3
第三章 系统分析 5
3.1可行性分析 5
3.1.1时间可行性 5
3.1.2 经济可行性 5
3.1.3 操作可行性 5
3.1.4 技术可行性 5
3.1.5 法律可行性 5
3.2系统流程分析 6
3.3系统功能需求分析 7
3.4 系统非功能需求分析 7
第四章 系统设计 9
4.1 总体功能 9
4.2 系统模块设计 9
4.3 数据库设计 10
4.3.1 数据库设计 10
4.3.2 数据库E-R 图 10
4.3.3 数据库表设计 11
第五章 系统实现 15
5.1 管理员功能模块的实现 15
5.1.1 问卷列表 15
5.1.2 公告信息管理 15
5.1.3 公告类型管理 16
第六章 系统测试 17
6.1软件测试 17
6.2测试环境 18
6.3 测试用例 18
6.3.1 用户登录测试 18
6.4.2 添加公告类别测试 18
6.5测试结果 18
结 论 19
参考文献 21
致 谢 22

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

qq_3306428634

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

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

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

打赏作者

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

抵扣说明:

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

余额充值