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

🙊作者简介:多年编程开发经验,专注java技术领域和毕业设计项目实战,系统定制、远程部署调试、代码讲解、代码修改
🍅擅长语言:springboot、ssm、vue、html、jsp、php、python、爬虫、小程序、安卓app
⬇️源码获取:文末可以获取源码+数据库+文档

 

⚡感兴趣的可以先收藏+关注,后续会更新更多项目资料,所有项目均配有开发文档和安装配置教程

5e2040037c8047fe91d6557da936a852.png

系统介绍    

使用旧方法对人事管理系统的信息进行系统化管理已经不再让人们信赖了,把现在的网络信息技术运用在人事管理系统的管理上面可以解决许多信息管理上面的难题,比如处理数据时间很长,数据存在错误不能及时纠正等问题。

这次开发的人事管理系统对字典管理、公告管理、绩效管理、培训管理、人事调动管理、薪资管理、员工管理、员工考勤管理、员工考勤详情管理、员工请假管理、招聘管理、管理员管理等进行集中化处理。经过前面自己查阅的网络知识,加上自己在学校课堂上学习的知识,决定开发系统选择小程序模式这种高效率的模式完成系统功能开发。这种模式让操作员基于浏览器的方式进行网站访问,采用的主流的Java语言这种面向对象的语言进行人事管理系统程序的开发,在数据库的选择上面,选择功能强大的Mysql数据库进行数据的存放操作。人事管理系统的开发让用户查看员工信息变得容易,让管理员高效管理员工信息。

系统主要技术

开发语言:Java

使用框架:SpringBoot

系统架构:B/S

前端技术:Vue、JavaScript

数据库 :Mysql 5.7/8.0

编译工具:idea或者eclipse,jdk1.8,maven

系统实现

5.1.1管理员登录

系统登录功能是程序必不可少的功能,在登录页面必填的数据有两项,一项就是账号,另一项数据就是密码,当管理员正确填写并提交这二者数据之后,管理员就可以进入系统后台功能操作区。下图就是管理员登录页面。

bab040698666494c9a02536b3696a898.png

图5.1 管理员登录页面

5.1.2 员工管理

项目管理页面提供的功能操作有:查看员工,删除员工操作,新增员工操作,修改员工操作。下图就是员工管理页面。

6cab9474542c486e8cd6858ef39e7cda.png

图5.2  员工管理页面

5.1.3 公告信息管理

公告信息管理页面提供的功能操作有:新增公告,修改公告,删除公告操作。下图就是公告信息管理页面。

98d34d11e8274bf28b44a044d6551ad2.png

图5.3 公告信息管理页面

5.1.4公告类型管理

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

c9fbc89ba7db4f53bddeffe5fb465c9b.png

图5.4 公告类型列表页面

 

 

5.1.5 培训管理

如图5.5显示的就是培训管理页面,此页面提供给管理员的功能有:新增培训,修改培训,删除培训。

db6f81537f114c3bad5f6e6660cda7fc.png

图5.5培训管理页面

5.1.6 培训类型管理

如图5.6显示的就是培训类型管理页面,此页面提供给管理员的功能有:新增培训类型,修改培训类型,删除培训类型。

a138bf5a2c524dffaa4f87a0ae686b0e.png

图5.6 培训类型管理页面

 

论文参考

ab48c76c33a247a68a5b69130262ad1a.png

1f1421171f6f4009a2b5abb93dfc39e0.png

b22f4fb2c61349f59b2adba5dc2342ba.png

核心代码


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

    private static final String TABLE_NAME = "renshidiaodong";

    @Autowired
    private RenshidiaodongService renshidiaodongService;


    @Autowired
    private TokenService tokenService;

    @Autowired
    private DictionaryService dictionaryService;//字典
    @Autowired
    private GonggaoService gonggaoService;//公告
    @Autowired
    private JixiaoService jixiaoService;//绩效
    @Autowired
    private PeixunService peixunService;//培训
    @Autowired
    private XinziService xinziService;//薪资
    @Autowired
    private YuangongService yuangongService;//员工
    @Autowired
    private YuangongKaoqinService yuangongKaoqinService;//员工考勤
    @Autowired
    private YuangongKaoqinListService yuangongKaoqinListService;//员工考勤详情
    @Autowired
    private YuangongqingjiaService yuangongqingjiaService;//员工请假
    @Autowired
    private ZhaopinService zhaopinService;//招聘
    @Autowired
    private UsersService usersService;//管理员


    /**
    * 后端列表
    */
    @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("yuangongId",request.getSession().getAttribute("userId"));
        CommonUtil.checkMap(params);
        PageUtils page = renshidiaodongService.queryPage(params);

        //字典表数据转换
        List<RenshidiaodongView> list =(List<RenshidiaodongView>)page.getList();
        for(RenshidiaodongView 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);
        RenshidiaodongEntity renshidiaodong = renshidiaodongService.selectById(id);
        if(renshidiaodong !=null){
            //entity转view
            RenshidiaodongView view = new RenshidiaodongView();
            BeanUtils.copyProperties( renshidiaodong , view );//把实体数据重构到view中
            //级联表 员工
            //级联表
            YuangongEntity yuangong = yuangongService.selectById(renshidiaodong.getYuangongId());
            if(yuangong != null){
            BeanUtils.copyProperties( yuangong , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yuangongId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
            view.setYuangongId(yuangong.getId());
            }
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

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

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

        YuangongEntity yuangong = yuangongService.selectById(renshidiaodong.getYuangongId());

        if(yuangong.getBumenTypes()==renshidiaodong.getBumenTypes() && yuangong.getZhiweiTypes()==renshidiaodong.getZhiweiTypes()){
            return R.error("部门和职位不能相同");
        }


        DictionaryEntity bumen = dictionaryService.selectOne(new EntityWrapper<DictionaryEntity>()
            .eq("dic_code", "bumen_types")
            .eq("code_index", yuangong.getBumenTypes())
        );
        renshidiaodong.setYuanBumen(bumen.getIndexName());
        DictionaryEntity zhiwei = dictionaryService.selectOne(new EntityWrapper<DictionaryEntity>()
                .eq("dic_code", "zhiwei_types")
                .eq("code_index", yuangong.getZhiweiTypes())
        );
        renshidiaodong.setYuanZhiwei(zhiwei.getIndexName());
        renshidiaodong.setInsertTime(new Date());
            renshidiaodong.setCreateTime(new Date());
            renshidiaodongService.insert(renshidiaodong);

            yuangong.setBumenTypes(renshidiaodong.getBumenTypes());
            yuangong.setZhiweiTypes(renshidiaodong.getZhiweiTypes());
            yuangongService.updateById(yuangong);
            return R.ok();
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody RenshidiaodongEntity renshidiaodong, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
        logger.debug("update方法:,,Controller:{},,renshidiaodong:{}",this.getClass().getName(),renshidiaodong.toString());
        RenshidiaodongEntity oldRenshidiaodongEntity = renshidiaodongService.selectById(renshidiaodong.getId());//查询原先数据

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

            renshidiaodongService.updateById(renshidiaodong);//根据id更新
            return R.ok();
    }



    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        List<RenshidiaodongEntity> oldRenshidiaodongList =renshidiaodongService.selectBatchIds(Arrays.asList(ids));//要删除的数据
        renshidiaodongService.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 yuangongId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        //.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))
        try {
            List<RenshidiaodongEntity> renshidiaodongList = 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){
                            //循环
                            RenshidiaodongEntity renshidiaodongEntity = new RenshidiaodongEntity();
//                            renshidiaodongEntity.setYuangongId(Integer.valueOf(data.get(0)));   //员工 要改的
//                            renshidiaodongEntity.setRenshidiaodongUuidNumber(data.get(0));                    //人事调动编号 要改的
//                            renshidiaodongEntity.setRenshidiaodongTypes(Integer.valueOf(data.get(0)));   //人事调动类型 要改的
//                            renshidiaodongEntity.setDiaodongTime(sdf.parse(data.get(0)));          //调动时间 要改的
//                            renshidiaodongEntity.setYuanBumen(data.get(0));                    //原部门 要改的
//                            renshidiaodongEntity.setYuanZhiwei(data.get(0));                    //原职位 要改的
//                            renshidiaodongEntity.setBumenTypes(Integer.valueOf(data.get(0)));   //部门 要改的
//                            renshidiaodongEntity.setZhiweiTypes(Integer.valueOf(data.get(0)));   //职位 要改的
//                            renshidiaodongEntity.setRenshidiaodongContent("");//详情和图片
//                            renshidiaodongEntity.setInsertTime(date);//时间
//                            renshidiaodongEntity.setCreateTime(date);//时间
                            renshidiaodongList.add(renshidiaodongEntity);


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

                        //查询是否重复
                         //人事调动编号
                        List<RenshidiaodongEntity> renshidiaodongEntities_renshidiaodongUuidNumber = renshidiaodongService.selectList(new EntityWrapper<RenshidiaodongEntity>().in("renshidiaodong_uuid_number", seachFields.get("renshidiaodongUuidNumber")));
                        if(renshidiaodongEntities_renshidiaodongUuidNumber.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(RenshidiaodongEntity s:renshidiaodongEntities_renshidiaodongUuidNumber){
                                repeatFields.add(s.getRenshidiaodongUuidNumber());
                            }
                            return R.error(511,"数据库的该表中的 [人事调动编号] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                        renshidiaodongService.insertBatch(renshidiaodongList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }




}

 

 

  • 14
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值