大家好!我是程序猿老A,感谢您阅读本文,欢迎一键三连哦。
💞当前专栏:Java毕业设计
精彩专栏推荐👇🏻👇🏻👇🏻
开发环境
- 开发语言:Java
- 框架:ssm
- JDK版本:JDK1.8
- 服务器:tomcat7
- 数据库:mysql 5.7
- 数据库工具:Navicat12
- 开发软件:eclipse/myeclipse/idea
- Maven包:Maven3.3.9
- 浏览器:谷歌浏览器
源码下载地址:
https://download.csdn.net/download/2301_76953549/89273728
论文目录
【如需全文请按文末获取联系】
一、项目简介
本次使用数据库工具MySQL和编程技术SSM开发的企业人事管理系统,可以实现目标用户群需要的功能,包括考勤管理,奖惩管理,薪资管理,培训管理,系统公告管理等功能。
二、系统设计
2.1软件功能模块设计
下图为管理员的功能设计,管理员管理所有权限的用户资料,管理考勤,培训,薪资,奖惩等资料。
下图为总经理的功能设计,总经理管理部门主管和员工的考勤信息,奖惩与薪资信息等。
下图为部门主管的功能设计,部门主管参与上下班打卡,管理员工的考勤和薪资以及奖惩信息。
下图为员工的功能设计,员工参与上下班打卡,查看自己的奖惩,薪资以及培训信息。
2.2数据库设计
(1)设计的员工用户实体,其具备的属性如下图。
(2)设计的考勤实体,其具备的属性如下图。
(3)设计的奖惩实体,其具备的属性如下图。
(4)设计的薪资实体,其具备的属性如下图。
(8)设计的实体间关系如下图。
三、系统项目部分截图
3.1管理员功能实现
用户管理
管理用户是管理员的功能。其运行效果图如下。这里的用户包括总经理,部门主管,员工,他们的资料都需要管理员来管理。
考勤管理
管理考勤是管理员的功能。其运行效果图如下。管理员查看所有人员的考勤打卡信息,包括上班打卡,下班打卡信息。
培训管理
管理培训信息是管理员的功能。其运行效果图如下。本模块主要让管理员查看所有人员的培训信息。
3.2总经理功能实现
奖惩管理
管理奖惩信息是总经理的功能。其运行效果图如下。总经理添加奖惩信息,查看部门主管和员工的奖惩信息。
薪资管理
管理薪资是总经理的功能。其运行效果图如下。总经理添加薪资信息,查看部门主管和员工的每月薪资。
3.3部门主管功能实现
考勤管理
管理员工的考勤信息是部门主管的功能。其运行效果图如下。部门主管可以参与上下班打卡,可以查看自己的考勤打卡信息。
奖惩管理
管理员工的奖惩信息是部门主管的功能。其运行效果图如下。部门主管能够新增员工的奖惩信息,可以查看部门员工的奖惩信息。
3.4员工功能实现
培训查看
查看培训信息是员工的功能。其运行效果图如下。员工可以在自己的后台查询培训信息,查看属于自己的培训详细信息。
薪资查看
查看薪资是员工的功能。其运行效果图如下。员工在当前页面只能查询薪资,查看自己的薪资明细。
考勤管理
管理个人的考勤信息是员工的功能。其运行效果图如下。员工参与上下班打卡,可以查询考勤记录信息。
四、部分核心代码
package com.controller;
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.StringUtil;
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.XinziEntity;
import com.service.XinziService;
import com.entity.view.XinziView;
import com.service.YonghuService;
import com.entity.YonghuEntity;
import com.utils.PageUtils;
import com.utils.R;
/**
* 薪资
* 后端接口
* @author
* @email
* @date 2021-04-12
*/
@RestController
@Controller
@RequestMapping("/xinzi")
public class XinziController {
private static final Logger logger = LoggerFactory.getLogger(XinziController.class);
@Autowired
private XinziService xinziService;
@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"));
YonghuEntity yonghuEntity = yonghuService.selectById((Integer) request.getSession().getAttribute("userId"));
if(role == null || "".equals(role) ){
return R.error(511,"您没有权限查看");
}else if (yonghuEntity == null ){
return R.error(511,"当前登录账户为空");
}else if ("员工".equals(role)){//员工只能查看自己的
params.put("yonghuId",request.getSession().getAttribute("userId"));
}else if ("部门主管".equals(role)){//主管可以查看当前部门下员工的
Integer bumenTypes = yonghuEntity.getBumenTypes();
params.put("roleTypes",1);//部门主管只能查看员工列表
params.put("bumenTypes",bumenTypes);//部门主管只能查看当前部门列表
}else if ("总经理".equals(role)){
params.put("roleTypes1111",1);//总经理不能查看总经理的
}
//管理员能查看全部
params.put("orderBy","id");
PageUtils page = xinziService.queryPage(params);
//字典表数据转换
List<XinziView> list =(List<XinziView>)page.getList();
if ("部门主管".equals(role)){//主管需要查看自己的考勤
List<XinziEntity> list1 = xinziService.selectList(new EntityWrapper<XinziEntity>().eq("yonghu_id", request.getSession().getAttribute("userId")));//查询当前用户的奖惩
for(XinziEntity l:list1){
XinziView view = new XinziView();
BeanUtils.copyProperties( l , view);//把entity封装在view中
BeanUtils.copyProperties( yonghuEntity , view ,new String[]{ "id", "createDate"});//把用户信息封装在view中
list.add(view);//放入list中
}
}
for(XinziView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
XinziEntity xinzi = xinziService.selectById(id);
if(xinzi !=null){
//entity转view
XinziView view = new XinziView();
BeanUtils.copyProperties( xinzi , view );//把实体数据重构到view中
//级联表
YonghuEntity yonghu = yonghuService.selectById(xinzi.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setYonghuId(yonghu.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody XinziEntity xinzi, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,xinzi:{}",this.getClass().getName(),xinzi.toString());
Wrapper<XinziEntity> queryWrapper = new EntityWrapper<XinziEntity>()
.eq("yonghu_id", xinzi.getYonghuId())
.eq("month", xinzi.getMonth())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
XinziEntity xinziEntity = xinziService.selectOne(queryWrapper);
if(xinziEntity==null){
xinzi.setCreateTime(new Date());
// String role = String.valueOf(request.getSession().getAttribute("role"));
// if("".equals(role)){
// xinzi.set
// }
xinziService.insert(xinzi);
return R.ok();
}else {
return R.error(511,"该员工该月份已经有薪资记录");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody XinziEntity xinzi, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,xinzi:{}",this.getClass().getName(),xinzi.toString());
//根据字段查询是否有相同数据
Wrapper<XinziEntity> queryWrapper = new EntityWrapper<XinziEntity>()
.notIn("id",xinzi.getId())
.andNew()
.eq("yonghu_id", xinzi.getYonghuId())
.eq("month", xinzi.getMonth())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
XinziEntity xinziEntity = xinziService.selectOne(queryWrapper);
if(xinziEntity==null){
// String role = String.valueOf(request.getSession().getAttribute("role"));
// if("".equals(role)){
// xinzi.set
// }
xinziService.updateById(xinzi);//根据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());
xinziService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}
获取源码或论文
如需对应的论文或源码,以及其他定制需求,也可以下方微❤联系。