Employee Management System
Employee Management System
using the Java Spring Framework and Thyme leaf templating engine. Leveraging the
power of these technologies, the system offers an intuitive and feature-rich platform
friendly interface. The utilization of Java Spring ensures scalability, security, and
reliability, while Thyme leaf facilitates dynamic and responsive web content
rendering.
attendance, assign tasks, and monitor progress with ease. Moreover, the EMS
and enhance operational efficiency. With its robust architecture and flexible design,
the Employment Management System developed with Java Spring Framework and
Thyme leaf caters to the evolving needs of businesses across industries, facilitating
Page |1
Certificate
Director/HOD
Page |2
ACKNOWLEDGEMENT
I have taken efforts in this project. However, it would not have been possible
without the kind support and help of my faculty members My team-members and my
friends Samagra and Prasant. I would like to extend my sincere thanks to all of them.
I am highly indebted to Mr. Aman Tyagi for their guidance and constant
& also, for their support in completing the project. I am extremely thankful to him
for providing such a nice support and guidance, although he had busy schedule
Institute of Technology and Management, Agra for their kind co-operation and
Page |3
PROJECT SYNOPSIS
TITLE: -EMPLOYEE MANAGEMENT SYSTEM
1. Introduction:
The Employee Management System (EMS) is a software solution designed to
streamline and automate various aspects of employee management within an
organization. This system aims to enhance efficiency, accuracy, and transparency in
managing employee information, attendance, performance, and payroll processing. By
leveraging Java programming language along with Hibernate, Spring framework, and
PostgreSQL database, the EMS offers a robust and scalable solution for modern
businesses.
2. Objectives:
- Develop a comprehensive employee database to securely store and manage
employee information.
- Automate the process of recording employee attendance and tracking their working
hours.
- Implement performance evaluation modules for assessing employee performance
based on predefined metrics.
- Facilitate payroll processing by accurately calculating salaries, deductions, and
related aspects.
- Provide a user-friendly interface for administrators and employees to interact with
the system efficiently.
3. Methodology:
The Employee Management System will be developed using Java programming
language for backend logic. Spring Hibernate ORM will be utilized for seamless
interaction with the PostgreSQL database, ensuring efficient data management. Spring
framework will be employed for dependency injection, transaction management, and
other enterprise-level features, facilitating rapid development and maintenance. The
system will follow a modular architecture, allowing for scalability and easy
integration of additional functionalities.
4. Technologies Used:
Java: For backend logic and application development.
Hibernate: For object-relational mapping (ORM) to interact with the PostgreSQL
database.
Spring Framework: For dependency injection, transaction management, and
enterprise-level features and also include Spring Security .
PostgreSQL: As the backend database management system for secure and efficient
data storage.
FrontEnd: Html, CSS and ThymeLeaf for Server Side Scripting
5. Key Features:
User Authentication and Authorization: Secure login and role-based access control
to ensure data privacy and security.
Page |4
with details such as personal information, contact details, and employment history.
6. Scope:
The Employee Management System encompasses modules for employee information
management, attendance tracking, performance evaluation, payroll processing,
reporting, and notification mechanisms. It provides a comprehensive solution for
managing various ADMIN tasks efficiently.
7. Internal Guide:
The internal guide for the
Employee Management System project is : - AMAN TYAGI SIR
8. Expected Outcomes:
-Efficient management of employee data and attendance records.
- Objective assessment of employee performance, facilitating performance reviews
and feedback.
- Accurate payroll processing, ensuring compliance with regulatory requirements.
- Enhanced transparency, communication, and productivity within the organization.
9. Timeline:
The development of the Employee Management System is expected to be completed
till 20th April 2024, including requirements gathering, design, development, testing,
and deployment phases.
10. Conclusion:
The Employee Management System using Java, Spring, Hibernate, and PostgreSQL
offers a comprehensive solution for organizations to effectively manage their
workforce. By leveraging modern technologies and best practices, the system aims to
enhance efficiency, accuracy, and transparency in employee management processes,
ultimately contributing to organizational success.
This project synopsis outlines the key aspects of the Employee Management System,
highlighting its objectives, methodology, expected outcomes, and scope. By following
this roadmap, the development team can proceed with the implementation of the
system effectively
Page |5
List of Figure
Fig I: ER Diagram 27
Fig II: Zero Level Diagram (DFD) 37
Fig III: First Level Diagram (DFD) 38
Fig IV: Second Level Diagram (DFD) 39
Fig V: Login Page 44
Fig VI: Employee Dashboard 45
Fig VII: Apply Leave 46
Fig VIII: Admin Attendance Management 46
Fig IX: Admin Main Dashboard 47
Fig X: Attendance Marking Panel 47
Fig XI: Notification Panel 48
Fig XII: Admin Leave Management 48
Fig XIII: Add New Employee Form 49
Fig XIV: Update Employee Form 49
Fig XV: Admin Table 58
Fig XVI: Leave Table 58
Fig XVII: Attendance Table 59
Fig XVIII: Employee Table 59
Fig XIX: Notification Table 60
Page |6
TABLE OF CONTENTS
Contents
Abstract
Certificate
Acknowledgement
List of Figure
Table of Contents
Chapter 1: Introduction
1.1 Introduction to Project
1.2 Project Category
1.3 Objectives
1.4 Problem Formulation
1.5 Identification/Reorganization of Need
1.6 Existing System
1.7 Proposed System
1.8 Unique Feature of the System
Chapter 2: Requirement Analysis and System Specification
2.1 Feasibility Study
2.1.1 Technical Feasibility
2.1.2 Economic Feasibility
2.1.3 Operational Feasibility
2.2 Software Requirement
2.2.1 Data Requirement
2.2.2 Functional Requirement
2.2.3 Performance Requirement
2.2.4 Dependability Requirement
2.2.5 Maintainability Requirement
2.2.6 Look and Feel Requirement
2.3 System Specification and Security Measures for Running the Project
2.4 Validation
2.5 Expected hurdles
Page |7
2.6 SDLC model to be used
2.6.1 Selection of SDLC Model
2.6.2 Agile Methodology
2.6.3 Agile in Attire Guru Development
2.6.4 Benefits of Agile in Attire Guru
3 Chapter 3: System Design and Security Consideration
3.1 Design Patterns
3.2 Security Consideration
3.3 Integration with Third Party Systems
3.4 Database Design
3.4.1 ER Diagrams
Chapter 4: Implementation, Testing and maintenance
4.1 Introduction to Languages, IDE’s, Tools and Technologies used for
Implementation
4.2 Coding standards of Language used
4.3 Project Scheduling
4.4 Testing Techniques and Test Plans
4.4.1 Unit Testing
4.4.2 Integration Testing
4.4.3 Functional Testing
4.4.4 Usability Testing
4.4.5 Cross-Browser Testing
4.4.6 Basic Test Plan
4.5 Data Flow Diagrams (DFDs)
4.5.1 Zero Level Diagram
4.5.2 First Level Diagram
4.5.3 Second Level Diagram
Chapter 5: Results and Discussions
5.1 User Interface Representation
5.2 Snapshots of System with brief detail of each
5.3 Back Ends Representation
Chapter 6: Conclusion
6.1 Conclusion
6.2 Future Scope
Page |8
CHAPTER – 1
INTRODUCTION
using Java Spring Framework, PostgreSQL, Thymeleaf, HTML, and CSS addresses
tasks. From onboarding new hires to tracking performance, this system streamlines
intuitive design principles, our system aims to revolutionize how businesses manage
their workforce.
performance evaluation, and payroll processing. Within this category, our system
Page |9
1.3 Objectives
Efficiency: Develop a system that automates routine ADMIN tasks, reducing manual
Scalability: Design a solution that can scale with the organization's growth,
training requirements.
Integration: Integrate seamlessly with existing systems and tools used by the
The core challenge addressed by the Employee Management System is the inefficient
sharing. The aim is to overcome these challenges by providing a unified platform that
P a g e | 10
1.5 Identification/Reorganization of Need
TAdminough stakeholder consultations and analysis of existing ADMIN processes,
employee management, leading to inefficiencies and errors. These systems often lack
may not offer modern features such as self-service portals or mobile accessibility,
PostgreSQL, Thymeleaf, HTML, and CSS to develop a modern and robust solution.
P a g e | 11
tracking, leave management, and performance evaluation to save time and reduce
errors.
leave requests, and access ADMIN policies and resources tAdminough self-service
portals.
security and restrict access to sensitive information based on user roles and
permissions.
offer letters, performance appraisals, and ADMIN policies to align with the
such as accounting software, CRM systems, and time tracking tools to facilitate data
screen sizes and devices, ensuring optimal user experience across desktops, tablets,
and smartphones.
P a g e | 12
CHAPTER – 2
Requirement Analysis and System Specification
A feasibility study is a crucial evaluation process that helps determine the viability
that the project aligns with the organization's objectives, resources, and constraints.
The feasibility study covers several key areas, including technical, economical,
look and feel, validation, expected hurdles, and the selection of an appropriate SDLC
technical resources and expertise to develop and implement the proposed system
infrastructure, and skilled personnel capable of working with the chosen technologies,
such as Java, Spring Framework, PostgreSQL, and web technologies (HTML, CSS,
frameworks with the selected technology stack and the availability of development
expenses, and ongoing operational costs, including licensing fees (if applicable),
P a g e | 13
hosting expenses, hardware and software acquisition costs, and training expenses.
These costs are then compared against the potential benefits and savings, such as
productivity, and cost savings from automating manual processes. The analysis helps
calculate the return on investment (ROI) and assess whether the project is
economically feasible.
factors such as the availability of skilled personnel, training requirements for existing
staff, integration with existing systems or databases, and the impact on current
for system maintenance, troubleshooting, and the need for change management efforts
technology stack and the availability of compatible development tools and IDEs.
P a g e | 14
2.2.1 Data Requirement
Data requirement involves identifying the data sources, data types, and data volumes
required for the Employee Management System. It includes assessing the data quality,
ADMIN systems, or manual records. Additionally, it determines the data types and
Data requirement involves identifying the data sources, data types, and data volumes
required for the Employee Management System. It includes assessing the data quality,
ADMIN systems, or manual records. Additionally, it determines the data types and
utilization. This includes defining the expected response times for various operations
(e.g., data retrieval, report generation, user interface interactions), determining the
anticipated user load and the system's ability to handle the expected concurrency, and
P a g e | 15
evaluating the need for caching mechanisms or performance optimization techniques.
tolerance requirements, as well as the necessary measures for data integrity, security,
and disaster recovery. For the Employee Management System, this involves assessing
the system's reliability and availability requirements, considering the critical nature of
employee data, determining necessary measures for data backup, recovery, and
disaster management, and ensuring compliance with relevant data protection and
Employee Management System over its lifecycle. It considers factors such as modular
design, documentation, and coding standards. This includes evaluating the modular
design and coding standards for ease of maintenance and future enhancements,
ensuring proper documentation and code comments for better understanding and
knowledge transfer, and assessing the availability of support and resources for future
Look and feel requirements define the desired user interface (UI) and user experience
P a g e | 16
user-friendly, and visually appealing. This involves defining the desired UI design,
including layout, color schemes, and branding elements, ensuring adherence to web
accessibility standards (e.g., WCAG) for users with disabilities, and considering
responsive design principles for optimal viewing across different devices and screen
sizes.
2.3 System Specification and Security Measures for Running the Project
Hardware Requirements:
• CPU: A multi-core processor with sufficient processing power to
handle incoming requests.
• RAM: Adequate RAM to support the application's memory
requirements, including caching and concurrent user sessions.
• Storage: Sufficient disk space for storing application files, databases,
and any necessary backups.
Operating System:
• The choice of operating system depends on the technologies being
used. Common choices include Linux distributions, Windows (e.g.,
Ubuntu, CentOS, Windows 7 or later) and Windows Server.
Web Server:
• Depending on the web application Spring framework being used you
may need a web server such as Apache HTTP Server or Nginx to
handle incoming HTTP requests and serve static files.
Database:
• If your web application requires a database (as in the case of the
Employee Management System with PostgreSQL), you'll need to
ensure compatibility with the chosen database management system
(DBMS) and allocate sufficient resources for its operation.
Networking:
• Sufficient bandwidth to handle incoming and outgoing network traffic,
especially during peak usage periods.
P a g e | 17
• Proper firewall configurations to protect the web application from
unauthorized access and potential security tAdmineats.
Software Dependencies:
• Ensure that the necessary software dependencies and libraries required
by your web application are installed and properly configured on the
server.
Security Measures:
• Implement appropriate security measures such as SSL/TLS encryption
for secure communication, regular software updates to patch known
vulnerabilities, and proper access controls to protect sensitive data.
Monitoring and Logging:
• Set up monitoring tools to track system performance, detect errors or
anomalies, and troubleshoot issues promptly.
• Configure logging mechanisms to record important events and user
actions for auditing and debugging purposes.
Backup and Disaster Recovery:
• Establish backup and disaster recovery procedures to protect against
data loss and ensure the availability of the web application in the
event of system failures or disasters
2.4 Validation
Validation outlines the methods and techniques for validating the Employee
acceptance criteria and testing strategies. This may involve outlining testing strategies
such as unit testing, integration testing, and user acceptance testing, defining test data
and test cases to validate the system's functionality and performance, and considering
P a g e | 18
2.5 Expected Hurdles
Expected hurdles identify potential risks, obstacles, and challenges that may arise
integration issues with existing systems, user resistance to change, regulatory changes
or updates to the chosen technologies, and the need for data privacy and security
The SDLC (Software Development Life Cycle) model to be used refers to the
Employee Management System project. This may involve evaluating the suitability of
combining Agile and Waterfall methodologies for different project phases. The
chosen SDLC model should align with the organization's preferred development
The selection of the SDLC model is a crucial decision that impacts the entire
P a g e | 19
2.6.2 Agile Methodology
that promotes rapid delivery of working software, frequent collaboration, and the
and adjustments.
Adopting the Agile methodology for the development of the Employee Management
System can bring several benefits. It allows for iterative and incremental
development, where features are delivered in sprints or iterations, enabling early and
System can benefit from increased flexibility, faster time-to-market, improved quality
tAdminough continuous testing and integration, and the ability to adapt to changing
P a g e | 20
CHAPTER – 3
System Design and Security Consideration
interconnected components: the model (data management), the view (user interface),
2. Repository Pattern: Abstracting the data access layer and providing a clean
interface for interacting with the database, promoting code reusability and testability.
3. Singleton Pattern: Ensuring that a class has only one instance and providing a
global point of access to it, useful for managing shared resources or configuration
settings.
(observers) are notified when the state of another object (subject) changes, facilitating
event-driven programming.
P a g e | 21
sensitive employee data. Security considerations should include:
financial details, both at rest (in the database) and in transit (during communication),
3. Input Validation: Validating and sanitizing user input to prevent injection attacks,
for data transmission and leveraging SSL/TLS protocols for encrypted data exchange.
5. Audit Logging: Maintaining detailed audit logs to track user activities, data
libraries, and underlying systems up-to-date with the latest security patches and
The Employee Management System may need to integrate with other existing systems
P a g e | 22
facilitate secure and controlled data exchange between the Employee Management
4. Error Handling and Logging: Implementing robust error handling and logging
The database design for the Employee Management System (EMS) is fundamental to
ensuring efficient data storage, retrieval, and management. The EMS database is
system known for its robustness, scalability, and compliance with SQL standards. The
following sections detail the core concepts and tables involved in this database design.
Key Concepts:
normalized, typically up to the third normal form (3NF). This involves dividing larger
tables into smaller, related tables and defining relationships between them.
P a g e | 23
Relationships: The EMS database includes various relationships between entities,
Indexes: Indexes are used to speed up the retrieval of data. Primary keys are
Constraints: Constraints ensure data integrity and consistency. Primary keys, foreign
keys, unique constraints, and check constraints are used to enforce rules at the
database level.
Employee Table
create table employee
(
emp_id varchar(255) not null
primary key,
contact varchar(255),
department varchar(255),
designation varchar(255),
email varchar(255),
emp_pic oid,
first_name varchar(255),
last_name varchar(255),
password varchar(255),
dob varchar(255),
user_role varchar(255),
emp_detail_qr oid,
reporting_role varchar(255),
reporting_manager varchar(255),
salt_value varchar(255),
reporting_team_leader varchar(255)
);
P a g e | 24
Admin Table
create table admin
(
emp_id varchar(255) not null
primary key,
contact varchar(255),
dob varchar(255),
email varchar(255),
emp_detail_qr oid,
emp_pic oid,
first_name varchar(255),
last_name varchar(255),
password varchar(255),
salt_value varchar(255),
user_role varchar(255)
);
Leave Table
create table leave
(
leave_id bigint not null
primary key,
emp_id varchar(255),
end_date varchar(255),
leave_type varchar(255),
reason varchar(255),
start_date varchar(255),
status varchar(255),
leave_days bigint
);
P a g e | 25
3.4.1 ER Diagram
Figure 1 ER Diagram
P a g e | 26
CHAPTER – 4
Implementation, Testing and maintenance
technologies. Java is the primary language used due to its object-oriented features,
which facilitate modular, reusable code and make it suitable for the scalable and
Database: PostgreSQL is chosen as the database system because of its open-source nature
and robust performance capabilities, including high volume transaction processing and
extensive indexing which are essential for managing large sets of employee data. On the front
end, Thymeleaf is used for rendering HTML in web applications, and it integrates well with
Spring, offering a server-side template engine that helps in building robust and flexible web
applications [citation:9]. HTML and CSS are foundational technologies used for creating and
styling the user interfaces, ensuring accessibility and responsiveness across different devices
refactoring tools
P a g e | 27
4.2 Coding standards of Language used
For Java development, adhering to coding standards is crucial to ensure that the code
remains clean, maintainable, and relatively free from bugs. This adherence helps in
work on the same codebase efficiently. Here are some of the best practices and tools
Naming Conventions
getEmployeeDetails).
Constants:
Error Handling
Proper error handling is critical to building a robust Java application. Following are
• Use checked exceptions for conditions from which the application might
P a g e | 28
Use Unchecked Exceptions for Programming Errors:
• Ensure that all exceptions are logged. This can be done using a logging
cannot be null")).
• Each method should perform a single task or logical unit of work. If a method
• Deeply nested loops and conditionals should be avoided as they make the code
difficult to read and understand. Use early returns and guard clauses to reduce
nesting.
hierarchies.
P a g e | 29
Tool Support in IntelliJ IDEA
IntelliJ IDEA provides excellent support for maintaining high coding standards
• IntelliJ IDEA allows configuring code style settings that automatically format
• The IDE includes built-in inspections that analyse the code for potential issues
improvement.
Code Coverage:
• IntelliJ IDEA supports code coverage tools that help in identifying untested
parts of the codebase. This is essential for ensuring that the unit tests cover all
critical paths.
Refactoring Tools:
• IntelliJ IDEA integrates seamlessly with version control systems like Git,
providing tools for code reviews, merge conflict resolution, and branch
management. This ensures that the codebase remains consistent and changes
P a g e | 30
4.3 Project Scheduling
Effective project scheduling is crucial for the timely and successful delivery of any
mitigating risks, and ensuring that the project meets its deadlines and objectives. In
the context of modern software development, Agile methodologies are widely adopted
Agile Methodologies
continuous feedback, and collaboration. These methodologies break down the project
into smaller, manageable units called sprints, typically lasting two to four weeks. Each
1. Sprints: Short, time-boxed periods during which specific work has to be completed
and made ready for review. Each sprint begins with a planning meeting to define the
sprint goals and ends with a review meeting to assess the work done and gather
feedback.
2. Daily Stand-ups: Brief daily meetings where team members discuss what they did
yesterday, what they plan to do today, and any blockers they are facing. This keeps
3. Sprint Reviews and Retrospectives: At the end of each sprint, a review meeting is
held to demonstrate the work completed and gather feedback from stakeholders. A
retrospective meeting follows to reflect on the sprint and discuss what went well, what
P a g e | 31
Tools and Integration
To support Agile project management, various tools are used for tracking and
collaboration. One of the most popular tools in the Agile community is JIRA.
JIRA:
• Task and Issue Tracking: JIRA allows teams to create, assign, and track tasks and
issues tAdminoughout the project lifecycle. This ensures that all work items are
• Sprint Planning and Management: JIRA’s Agile boards (Scrum or Kanban) help in
planning sprints, organizing tasks, and managing the workflow. Teams can easily drag
remaining in a sprint, helping teams to monitor progress and predict whether they will
• Seamless Workflow: IntelliJ IDEA integrates with JIRA, providing developers with
direct access to JIRA tasks from within the IDE. This integration allows developers to
link commits to JIRA issues, update task statuses, and view task details without
• Time Tracking: Developers can log their work hours directly from IntelliJ IDEA,
1. Define Project Scope and Objectives: Clearly outline the goals, deliverables, and
P a g e | 32
constraints of the project. This involves collaborating with stakeholders to understand
2. Break Down the Work: Decompose the project into smaller tasks and subtasks. Each
3. Establish Timelines: Determine the duration of each sprint and create a project
4. Assign Responsibilities: Allocate tasks to team members based on their skills and
5. Monitor and Adjust: Continuously monitor the progress of the project using JIRA
and Agile boards. Adjust the plan as necessary based on feedback, changes in
teams can ensure that they are utilized efficiently tAdminoughout the project.
tracking tools foster better communication and collaboration among team members
and stakeholders.
changes in requirements or priorities, ensuring that the final product aligns with user
needs.
• Increased Visibility: Tools like JIRA provide real-time visibility into the project’s
P a g e | 33
4.4 Testing Techniques and Test Plans
units of code to ensure they function correctly in isolation. Tools: JUnit, integrated
1. Write Test Cases: Create specific test methods for the unit.
3. Analyse Results: Identify and fix any issues based on test outcomes.
Definition and Purpose: Functional testing ensures that the system operates according
P a g e | 34
Definition and Purpose: Usability testing assesses how user-friendly and intuitive the
correctly across different web browsers and platforms. Tools: Browser Stack. Process:
The basic test plan outlines how testing should be approached, documenting the
specifics of each testing stage, requirements for passing each stage, and detailed steps
for executing tests. This structured approach helps in thorough verification of the
P a g e | 35
4.5 Data Flow Diagrams (DFDs)
P a g e | 36
4.5.2 First Level Diagram
P a g e | 37
4.5.3 Second Level Diagram
P a g e | 38
CHAPTER – 5
Designing the user interface (UI) for the Employee Management System (EMS)
involves creating an intuitive and user-friendly experience for all users, including
navigation, efficient data entry, and quick access to essential features. Below is a
1. Login Page
The login page is the entry point for all users. It should have fields for username and
password, and options for different user roles (Employee, Team Leader Manager,
Admin).
• Elements:
• Login button
2. Dashboard
After logging in, users are directed to the dashboard. The dashboard displays relevant
• Admin Dashboard:
P a g e | 39
• Summary statistics (e.g., number of employees, department
• Employee Dashboard:
details
• Manager Dashboard:
• Quick links to system settings, user role management, and audit logs
Admin managers can add, update, delete, and view employee information here.
• Elements:
etc.)
• Elements:
• List of roles within each department with options to add, edit, or delete
P a g e | 40
5. Attendance Management Page
• Elements:
7. Settings Page
• Elements:
etc.)
8. Profile Page
• Elements:
etc.)
A unified section where users can view system notifications and alerts.
• Elements:
P a g e | 41
• List of notifications with timestamps
• Notification settings
To ensure the UI is effective and user-friendly, the following design principles should
be adhered to:
1. Simplicity: Keep the interface simple and uncluttered. Each page should focus
application. This helps users learn the system faster and reduces confusion.
errors.
experience.
P a g e | 42
5.2 Snapshots of System with brief detail of each
Login Page: This is the entry page or homepage the Employee Management
System. By this page Employe, Team Leader, Manager and Admin can login.
The Entity required their Employee/Admin Code and Password for the login
After that an OTP is sent to the Entities registered mail. After the successful
authentication entities is Login.
P a g e | 43
Figure 6 Employee Dashboard
Employee Dashboard: This is the Employee Dashboard in this Employee can check
By this dashboard Employee check their attendance and apply Leave and also update
their password.
Left Sidebar
Additional Elements
• Notifications: A button in the bottom right corner labeled "Open Notifications" for
viewing notifications.
P a g e | 44
Figure 7 Apply Leave
Apply Leave: This is the Employee Apply Leave Panel by this employee can apply
Employee Attendance: This is the Admin Panel in which Admin and other access
P a g e | 45
Figure 9 Admin Main Dashboard
LAdmin Main Dashboard: This is the main dashboard of Admin by this Admin can
check the all Employees and Add new employee delete and also modify the details of
employee.
Attendance Marking Panel: This is the attendance marking panel by this employee
P a g e | 46
Figure 11 Notification Panel
Employee Notification Panel: This is the Notification panel of Employee Where all
Admin Leave Management: In this dashboard all the incoming leave request of all
P a g e | 47
Figure 13 Add New Employee Form
Add New Employee Form: Admin used this form to register new Employees to the
Panel.
Update Employee Form: This form used by admin to update the employee details.
P a g e | 48
Login Controller
package com.project.ems.controller;
import com.project.ems.model.Admin;
import com.project.ems.model.Employee;
import com.project.ems.service.EmployeeService;
import com.project.ems.service.LoginService;
import jakarta.servlet.ServletContext;
import jakarta.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.boot.actuate.autoconfigure.observation.Obs
ervationProperties;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Enumeration;
import java.util.Objects;
@Controller
public class LoginController {
@Autowired
private HttpSession session;
@GetMapping("/ems/login")
public String getLoginPage(){
return "login1";
}
@PostMapping("/ems/loginPage")
public String loginPage(@RequestParam("empId")String
empId, @RequestParam("password")String password, Model model){
String userRole=
loginService.validateUser(empId,password);
if(userRole==null){
return "redirect:/ems/login?fail";
}
P a g e | 49
return
"redirect:/ems/login/validate/"+empId+"/"+userRole;
//return
"redirect:/ems/employee/dashboard/"+userRole+"/"+empId;
@GetMapping("/ems/login/validate/{empId}/{userRole}")
public String validateOtp(@PathVariable("empId")String
empId,@PathVariable("userRole")String userRole, Model model)
{
if(Objects.equals(userRole, "admin")) {
Admin admin = employeeService.findAdmin(empId);
String genV =
loginService.sendMail(admin.getEmail());
model.addAttribute("empId", empId);
model.addAttribute("userRole", userRole);
model.addAttribute("genV",genV);
return "enterOTp";
}
else {
Employee employee =
employeeService.findEmployee(empId);
String genV =
loginService.sendMail(employee.getEmail());
model.addAttribute("empId", empId);
model.addAttribute("userRole", userRole);
model.addAttribute("genV", genV);
return "enterOTp";
}
}
@PostMapping("/ems/login/validate/{userRole}/{empId}")
public String validateOtp(@RequestParam("genV")String
genV,@RequestParam("otp")String
otp,@PathVariable("empId")String
empId,@PathVariable("userRole")String userRole){
if(genV.equals(otp))
{
if(userRole.equals("employee")){
session.setAttribute("user",userRole);
return"redirect:/ems/dashboard/employee/"+empId;
}
if(userRole.equals("admin")){
session.setAttribute("user",userRole);
return "redirect:/ems/dashboard/admin/"+empId;
}
if(userRole.equals("teamLeader")){
session.setAttribute("user",userRole);
return
"redirect:/ems/dashboard/teamLeader/"+empId;
}
if(userRole.equals("manager")){
P a g e | 50
System.out.println(userRole);
session.setAttribute("user",userRole);
return
"redirect:/ems/dashboard/manager/"+empId;
}
}
return
"redirect:/ems/login/validate/"+empId+"/"+userRole+"?fail";
}
@GetMapping("/ems/error")
public String errorPage(){
return "errorPage";
}
@GetMapping("/ems/logout")
public String logout(){
session.invalidate();
return "redirect:/ems/login";
}
@GetMapping("/ems/login/admin")
public String adminLogin(){
return "login";
}
@PostMapping("/ems/login/admin")
public String adminLogin(@RequestParam("empId")String
empId, @RequestParam("password")String password, Model model){
String userRole=
loginService.validateAdmin(empId,password);
if(userRole==null){
return "redirect:/ems/login/admin?fail";
}
return
"redirect:/ems/login/validate/"+empId+"/"+userRole;
//return
"redirect:/ems/employee/dashboard/"+userRole+"/"+empId;
}
}
Employee Controller:
package com.project.ems.controller;
import com.project.ems.extras.News;
import com.project.ems.model.Admin;
import com.project.ems.model.Employee;
import com.project.ems.model.Leave;
import com.project.ems.model.Notification;
import com.project.ems.repository.AttendanceRepository;
import com.project.ems.service.*;
import jakarta.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
P a g e | 51
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.text.DecimalFormat;
import java.util.List;
import java.util.Objects;
@Controller
public class EmployeeController {
employeeService.saveEmployeeImage(imageFile,empId,userRole);
} catch (Exception e) {
throw new RuntimeException(e);
}
return"redirect:/ems/dashboard/admin/allEmployees/"+roleId;
}
@GetMapping("/ems/editImage/{empId}/{roleId}")
public String updateImageForm(@PathVariable("empId")String
empId,@PathVariable("roleId")String roleId, Model model){
P a g e | 52
model.addAttribute("empId",empId);
model.addAttribute("roleId",roleId);
return "upload-employeePic";
}
@GetMapping("/ems/updateEmployee/employeeForm/{empId}/{roleId}")
public String showUpdateEmployeeForm(@PathVariable("empId")String
empId,@PathVariable("roleId")String roleId ,Model model){
Employee employee = employeeService.getEmployee(empId);
model.addAttribute("employee",employee);
model.addAttribute("roleId",roleId);
return "update-employeeForm";
}
@PostMapping("/ems/updateEmployee/update/{empId}/{roleId}")
public String UpdateEmployee(@ModelAttribute("employee")Employee
employee,@PathVariable("roleId")String
roleId,@PathVariable("empId")String empId,Model model){
String
userRole=employeeService.updateEmployee(employee,empId);
return "redirect:/ems/dashboard/admin/allEmployees/"+roleId;
}
@GetMapping("/ems/deleteEmployee/{empId}/{roleId}")
public String deleteEmployee(@PathVariable("empId")String
empId,@PathVariable("roleId")String roleId, Model model){
employeeService.deleteEmployee(empId);
return"redirect:/ems/dashboard/admin/allEmployees/"+roleId;
}
@GetMapping("/ems/searchEmployees")
public String searchEmployee(@RequestParam(value="query")String
query, Model model){
List <Employee> employee =
employeeService.searchEmployee(query);
model.addAttribute("employee",employee);
return "allEmployees";
}
@GetMapping("/ems/dashboard/admin/{empId}")
public String showAdminDashboard(@PathVariable("empId")String
empId, Model model){
Double attendance=attendanceService.getAttendance(empId);
Long totalEmployees=employeeService.getTotalEmployee();
String userRole = (String) session.getAttribute("user");
if(userRole=="null") {
return "redirect:/ems/error";
}
else if(Objects.equals(userRole, "admin")){
System.out.println(userRole);
Admin admin = employeeService.findAdmin(empId);
model.addAttribute("roleId", empId);
model.addAttribute("attendance",df.format(attendance));
model.addAttribute("employee", admin);
model.addAttribute("totalEmployees",totalEmployees);
return "AdminDashboard";
}
else
return "redirect:/ems/error";
}
@GetMapping("/ems/dashboard/employee/{empId}")
public String showEmployeeDashboard(@PathVariable("empId")String
empId, Model model){
Double attendance=attendanceService.getAttendance(empId);
P a g e | 53
List<Notification>notifications=notificationService.getNotification(e
mpId);
String userRole = (String) session.getAttribute("user");
if(userRole=="null") {
return "redirect:/ems/error";
}
else if(Objects.equals(userRole, "employee")){
System.out.println(userRole);
Employee employee = employeeService.getEmployee(empId);
model.addAttribute("empId", empId);
model.addAttribute("employee", employee);
model.addAttribute("notification",notifications);
model.addAttribute("attendance",df.format(attendance));
return "EmployeeDashboard";
}
else
return "redirect:/ems/error";
}
@GetMapping("/ems/dashboard/manager/{empId}")
public String showManagerDashboard(@PathVariable("empId")String
empId, Model model){
Double attendance=attendanceService.getAttendance(empId);
List<Notification>notifications=notificationService.getNotification(e
mpId);
String userRole = (String) session.getAttribute("user");
System.out.println(userRole);
if(userRole=="null") {
return "redirect:/ems/error";
}
else if(Objects.equals(userRole, "manager")){
System.out.println(userRole);
Employee employee = employeeService.getEmployee(empId);
model.addAttribute("empId", empId);
model.addAttribute("notification",notifications);
model.addAttribute("attendance",df.format(attendance));
model.addAttribute("employee", employee);
return "ManagerDashboard";
}
else
return "redirect:/ems/error";
}
@GetMapping("/ems/dashboard/teamLeader/{empId}")
public String
showTeamLeaderDashboard(@PathVariable("empId")String empId, Model
model){
Double attendance=attendanceService.getAttendance(empId);
List<Notification>notifications=notificationService.getNotification(e
mpId);
String userRole = (String) session.getAttribute("user");
System.out.println(userRole);
if(userRole=="null") {
return "redirect:/ems/error";
}
else if(Objects.equals(userRole, "teamLeader")){
System.out.println(userRole);
P a g e | 54
Employee employee = employeeService.getEmployee(empId);
model.addAttribute("empId", empId);
model.addAttribute("notification",notifications);
model.addAttribute("attendance",df.format(attendance));
model.addAttribute("employee", employee);
return "TeamLeaderDashboard";
}
else
return "redirect:/ems/error";
}
@PostMapping("/ems/employee/updatePassword/{empId}")
public String UpdatePassWord(@PathVariable("empId")String
empId,@RequestParam("pass")String
pass,@RequestParam("confirmPass")String confirmPass, Model model){
String
status=employeeService.updateEmployeePass(empId,pass,confirmPass);
return
"redirect:/ems/employee/dashboard/user/"+empId+"?"+status;
}
@PostMapping("/ems/admin/updatePassword/{empId}")
public String UpdateAdminPassWord(@PathVariable("empId")String
empId,@RequestParam("pass")String
pass,@RequestParam("confirmPass")String confirmPass, Model model){
String
status=employeeService.updateAdminPass(empId,pass,confirmPass);
return "redirect:/ems/dashboard/admin/"+empId+"?"+status;
}
@GetMapping("/ems/employee/applyLeave/{empId}")
public String applyLeaveFormEmployee(@PathVariable("empId")String
empId, Model model){
List<Leave> leave = leaveService.findHistory(empId);
List<Notification>notifications=notificationService.getNotification(e
mpId);
Leave leave1= new Leave();
leave1.setEmpId(empId);
model.addAttribute("leave",leave);
model.addAttribute("empId",empId);
model.addAttribute("notification",notifications);
model.addAttribute("leave1",leave1);
return "employLeaveForm";
}
@GetMapping("/ems/manager/applyLeave/{empId}")
public String applyLeaveFormManager(@PathVariable("empId")String
empId, Model model){
List<Leave> leave = leaveService.findHistory(empId);
List<Notification>notifications=notificationService.getNotification(e
mpId);
Leave leave1= new Leave();
leave1.setEmpId(empId);
model.addAttribute("leave",leave);
model.addAttribute("notification",notifications);
model.addAttribute("empId",empId);
model.addAttribute("leave1",leave1);
return "managerLeaveForm";
}
@GetMapping("/ems/teamLeader/applyLeave/{empId}")
public String
P a g e | 55
applyLeaveFormTeamLeader(@PathVariable("empId")String empId, Model
model){
List<Leave> leave = leaveService.findHistory(empId);
List<Notification>notifications=notificationService.getNotification(e
mpId);
Leave leave1= new Leave();
leave1.setEmpId(empId);
model.addAttribute("leave",leave);
model.addAttribute("empId",empId);
model.addAttribute("notification",notifications);
model.addAttribute("leave1",leave1);
return "teamLeaderLeaveForm";
}
@PostMapping("/ems/employee/applyLeave/{empId}")
public String applyLeave(@PathVariable("empId")String empId,
@ModelAttribute("leave1")Leave leave1, Model model,
@RequestParam("leaveType")String
leaveType,@RequestParam("startDate")String
startDate,@RequestParam("endDate")String endDate,
@RequestParam("reason")String reason){
leave1.setReason(reason);
leave1.setEndDate(endDate);
leave1.setStatus("pending");
leave1.setEmpId(empId);
leave1.setStartDate(startDate);
leaveService.saveLeave(leave1);
return "redirect:/ems/employee/applyLeave/"+empId;
}
@PostMapping("/ems/manager/applyLeave/{empId}")
public String applyLeaveManager(@PathVariable("empId")String
empId, @ModelAttribute("leave1")Leave leave1, Model model,
@RequestParam("leaveType")String
leaveType,@RequestParam("startDate")String
startDate,@RequestParam("endDate")String endDate,
@RequestParam("reason")String reason){
leave1.setReason(reason);
leave1.setEndDate(endDate);
leave1.setStatus("pending");
leave1.setEmpId(empId);
leave1.setStartDate(startDate);
leaveService.saveLeave(leave1);
return "redirect:/ems/manager/applyLeave/"+empId;
}
@PostMapping("/ems/teamLeader/applyLeave/{empId}")
public String applyLeaveTeamLeader(@PathVariable("empId")String
empId, @ModelAttribute("leave1")Leave leave1, Model model,
@RequestParam("leaveType")String
leaveType,@RequestParam("startDate")String
startDate,@RequestParam("endDate")String endDate,
@RequestParam("reason")String reason){
leave1.setReason(reason);
leave1.setEndDate(endDate);
leave1.setStatus("pending");
leave1.setEmpId(empId);
leave1.setStartDate(startDate);
leaveService.saveLeave(leave1);
return "redirect:/ems/teamLeader/applyLeave/"+empId;
P a g e | 56
}
@GetMapping("/ems/employee/getNews")
public String getAllNews(Model model){
News news = new News();
List getNews = news.getNews();
model.addAttribute("news",getNews);
return "news";
}
}
Employee Model:
package com.project.ems.model;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@NoArgsConstructor
@AllArgsConstructor
@Data
@Entity
public class Employee {
@Id
private String empId;
private String firstName;
private String lastName;
private String contact;
private String dob;
private String email;
private String userRole;
private String department;
private String designation;
private String password;
private String reportingRole;
private String reportingTeamLeader;
private String reportingManager;
private String saltValue;
@Lob
private String empPic;
@Lob
private String empDetailQr;
}
P a g e | 57
Snapshots of Database
P a g e | 58
Figure 17 Attendance Table
P a g e | 59
Figure 19 Notification Table
P a g e | 60
CHAPTER – 6
6.1 Conclusion
As businesses grow and evolve, the EMS can be expanded with advanced features and
tools for global workforce management can further increase the system's value.
adapting and incorporating new technologies and user feedback, the EMS can remain
Expanding the scope of the Employee Management System (EMS) can enhance its
functionality and adaptability to future needs. Here are several potential areas for
future development:
P a g e | 61
1. Advanced Analytics and Reporting
2. Mobile Application
• Native Mobile Apps: Develop native mobile applications for iOS and
• Audit Logging: Add detailed audit logging to track changes and access to
sensitive data, which can help in monitoring and securing the system.
4. Performance Management
• Goal Setting and Tracking: Implement features for setting, tracking, and
P a g e | 62
5. Artificial Intelligence and Machine Learning
a global workforce.
• Social Features: Introduce social features like forums, groups, and activity
P a g e | 63