前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >BS1078-基于java+springmvc+mysql+mybatis实现企业员工信息管理系统

BS1078-基于java+springmvc+mysql+mybatis实现企业员工信息管理系统

作者头像
计算机程序优异哥
发布2023-09-18 10:37:15
2670
发布2023-09-18 10:37:15
举报
文章被收录于专栏:毕设程序汇总毕设程序汇总

本企业员工信息管理系统的设计与实现,系统主要采用java,springMVC,mybatis,mysql数据库,JSP开发技术,针对互联网企业公司内部的员工,部门,考勤,请假,工资,奖惩,意见反馈等数据采用关系数据库mysql进行存储分析,系统主要通过前后端开发技术整合,搭建综合性的企业员工信息管理系统。

企业员工信息管理系统的设计与实现主要包含:个人中心,员工管理,部门管理,考勤信息管理,员工工资管理,请假信息管理,奖惩信息管理,意见反馈管理,系统管理等

原文地址

一、程序设计

本企业员工信息管理系统的设计与实现,主要内容涉及:

主要功能模块:个人中心,员工管理,部门管理,考勤信息管理,员工工资管理,请假信息管理,奖惩信息管理,意见反馈管理,系统管理等

二、效果实现

用户登录

三、代码实现

企业员工信息管理系统的设计与实现的设计与开发,主要采用前后端模式,针对高校内部的员工,部门,考勤,请假,工资,奖惩,意见反馈等等数据封装成JSON格式,完成数据下发至系统界面端渲染,系统界面端针对JSON解析后采用javascript完成页面展示。其中系统主要采用java+javascript开发实现,系统基础数据库采用mysql关系数据库,核心代码逻辑如下:

代码语言:java
复制
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, 
						 @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
		map.put("column", columnName);
		map.put("type", type);
		
		if(type.equals("2")) {
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			Calendar c = Calendar.getInstance();
			Date remindStartDate = null;
			Date remindEndDate = null;
			if(map.get("remindstart")!=null) {
				Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
				c.setTime(new Date()); 
				c.add(Calendar.DAY_OF_MONTH,remindStart);
				remindStartDate = c.getTime();
				map.put("remindstart", sdf.format(remindStartDate));
			}
			if(map.get("remindend")!=null) {
				Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
				c.setTime(new Date());
				c.add(Calendar.DAY_OF_MONTH,remindEnd);
				remindEndDate = c.getTime();
				map.put("remindend", sdf.format(remindEndDate));
			}
		}
		
		Wrapper<KaoqinxinxiEntity> wrapper = new EntityWrapper<KaoqinxinxiEntity>();
		if(map.get("remindstart")!=null) {
			wrapper.ge(columnName, map.get("remindstart"));
		}
		if(map.get("remindend")!=null) {
			wrapper.le(columnName, map.get("remindend"));
		}

		String tableName = request.getSession().getAttribute("tableName").toString();
		if(tableName.equals("yuangong")) {
			wrapper.eq("yuangonggonghao", (String)request.getSession().getAttribute("username"));
		}

		int count = kaoqinxinxiService.selectCount(wrapper);
		return R.ok().put("count", count);
	}

员工考勤通常涉及到很多复杂的逻辑和规则,这可能取决于公司的特定需求和规定。下面是一个非常基础的示例,仅包括迟到和早退的记录。在实际应用中,您可能需要更详细的信息,例如迟到和早退的时间,是否有加班,等等。

这个例子假设每个员工每天都有两次打卡:早上和晚上。如果员工在规定的时间(例如,早上9点到下午6点)内两次打卡,那么他们就被认为是正常出勤。如果他们早于9点或晚于6点打卡,那么他们就会被记录为早到或晚退。

步骤:

创建一个员工类(Employee)

创建一个考勤类(Attendance)

创建一个测试类(例如,Main)来演示如何使用这两个类。

代码:Employee 类

代码语言:java
复制
public class Employee {
    private String name;
    private boolean isPresent;

    public Employee(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void markPresent() {
        isPresent = true;
    }

    public boolean isPresent() {
        return isPresent;
    }
}

Attendance 类

代码语言:java
复制
import java.util.HashMap;
import java.util.Map;

public class Attendance {
    private Map<Employee, Boolean> attendance;

    public Attendance() {
        attendance = new HashMap<>();
    }

    public void punchIn(Employee employee) {
        attendance.put(employee, true);
    }

    public void punchOut(Employee employee) {
        if (attendance.containsKey(employee) && attendance.get(employee)) {
            attendance.put(employee, false);
        } else {
            System.out.println("Employee " + employee.getName() + " hasn't punched in.");
        }
    }
}

Main 类

代码语言:java
复制
public class Main {
    public static void main(String[] args) {
        // 创建员工和考勤对象
        Employee employee1 = new Employee("John");
        Employee employee2 = new Employee("Jane");
        Attendance attendance = new Attendance();
        // 设定工作时间为9点到18点,这里只是示例,实际应用中应该设定为具体的时间范围。
        int workingHoursStart = 9; 
        int workingHoursEnd = 18; 
        // 假设John在9点前打卡上班,Jane在9点后打卡上班。他们都需要在18点后打卡下班。
        attendance.punchIn(employee1); // John punches in early. He will be marked as present. 
        attendance.punchIn(employee2); // Jane punches in on time. She will be marked as present. 
        // 假设John在18点前打卡下班,Jane在18点后打卡下班。他们的出勤记录应该都是正常的。 
        attendance.punchOut(employee1); // John punches out early. This is fine as long as he punched in on time. 
        attendance.punchOut(employee2); // Jane punches out on time. This is fine as long as she punched in on time. 
        // 打印出勤记录。 
        System.out.println("John is present: " + employee1.isPresent()); // Should print "true" 
        System.out.println("Jane is present: " + employee2.isPresent()); // Should print "true" 
    }   
}

示例是一个非常简化的版本,实际上可能需要更复杂的逻辑,比如考虑员工的假期、加班等等。如果你需要处理更复杂的情况,可能需要创建一个更复杂的考勤系统

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
作者已关闭评论
0 条评论
热度
最新
推荐阅读
目录
  • 一、程序设计
  • 二、效果实现
    • 用户登录
    • 三、代码实现
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档