How vvr-vikram/hrms-service works
Purpose and Runtime
hrms-service is a Java/Spring Boot REST backend for human-resources operations: employee records, attendance, leave, payroll, shifts, salary structures, and related employee data. The application starts at src/main/java/com/oneenterprise/JrmsApplication.java; Maven dependencies/build are defined in pom.xml.
API and Request Boundary
HTTP entry points are domain controllers: src/main/java/com/oneenterprise/controller/EmployeeController.java, src/main/java/com/oneenterprise/controller/AttendanceController.java, and src/main/java/com/oneenterprise/controller/LeaveController.java (plus payroll and authentication controllers). Requests and responses cross an explicit DTO boundary under src/main/java/com/oneenterprise/dto/request and src/main/java/com/oneenterprise/dto/response, rather than exposing persistence entities directly. Errors are normalized centrally by src/main/java/com/oneenterprise/exception/GlobalExceptionHandler.java.
Authentication, Authorization, and Cross-Cutting Audit
Security is configured in src/main/java/com/oneenterprise/config/SecurityConfig.java. JWT-bearing requests pass through src/main/java/com/oneenterprise/security/JwtAuthenticationFilter.java, using src/main/java/com/oneenterprise/util/JwtTokenUtil.java; AuthController is the authentication-facing endpoint. Audit behavior is separated from business services through src/main/java/com/oneenterprise/audit/AuditAspect.java and src/main/java/com/oneenterprise/audit/AuditInterceptor.java, with audit records modeled by AuditLog.java.
Core Service Layer
Controllers delegate to interfaces and implementations, keeping business workflows behind service boundaries: src/main/java/com/oneenterprise/service/EmployeeService.java / src/main/java/com/oneenterprise/service/impl/EmployeeServiceImpl.java, src/main/java/com/oneenterprise/service/impl/LeaveServiceImpl.java, and src/main/java/com/oneenterprise/service/impl/PayrollServiceImpl.java. This layer validates domain rules, coordinates repositories, translates entities via mappers, and returns response DTOs.
HR Domain and Persistence
JPA-style domain storage centers on employees and linked HR facts: src/main/java/com/oneenterprise/entity/EmployeeEntity.java, src/main/java/com/oneenterprise/entity/AttendanceEntity.java, src/main/java/com/oneenterprise/entity/LeaveRequestEntity.java, and payroll/payslip entities. Repository interfaces form the database boundary, including src/main/java/com/oneenterprise/repository/EmployeeRepository.java, src/main/java/com/oneenterprise/repository/LeaveBalanceRepository.java, and src/main/java/com/oneenterprise/repository/PayrollRepository.java. Mapper classes, such as src/main/java/com/oneenterprise/mapper/EmployeeMapper.java, isolate DTO/entity conversion.
Principal Workflow Areas
Employee management includes profile, skills, certifications, documents, and emergency contacts; creation emits src/main/java/com/oneenterprise/event/EmployeeCreatedEvent.java, handled by EmployeeEventListener.java. Attendance and overtime are processed through AttendanceServiceImpl and OvertimeEntity. Leave processing combines leave types, requests, approval input, statuses, and balances through LeaveServiceImpl, LeaveRequestEntity, and LeaveBalanceEntity. Payroll generation uses salary structures, payroll runs, and payslips through PayrollServiceImpl, PayrollEntity, and PayslipEntity.
Infrastructure and Lifecycle
Runtime configuration is in src/main/resources/application.yml with development overrides in src/main/resources/application-dev.yml. Database schema lifecycle is Flyway-style migration SQL: src/main/resources/db/migration/V1__create_employee_tables.sql and V2__create_attendance_leave_payroll_tables.sql. External-facing assumptions visible in the repository are an HTTP API client (the supplied HRMS_Postman_Collection.json), JWT authentication, and a relational database; no other remote service integration is represented.
Components 18
HTTP API
- HR controllers · Employee, attendance, leave, payroll, and authentication endpoints.
- Request / response DTOs · Separates HTTP payloads from entities.
- Global exception handler · Normalizes API errors.
Security & Audit
- Security configuration
- JWT authentication filter
- JWT token utility
- Audit aspect and interceptor · Captures audited operations as audit logs.
HR Workflows
- Employee service · Manages employee profiles and related employee data.
- Attendance and overtime
- Leave workflow · Processes leave requests, approvals, statuses, and balances.
- Payroll workflow · Generates payroll runs and payslips from salary structures.
- Employee-created event · Handled after employee creation.
Persistence
- Entity / DTO mappers
- HR repositories · Employee, leave-balance, and payroll repository interfaces.
- HR entities · Employees, attendance, leave requests, payroll, payslips, and overtime.
- Relational database · Schema is managed through Flyway migrations.
Other components
- Spring Boot application · Bootstraps the REST service.
- Runtime configuration
Connections 24
- Spring Boot application → Security configuration: initializes
- Spring Boot application → HR controllers: serves
- Spring Boot application → Runtime configuration: loads
- Security configuration → JWT authentication filter: registers
- JWT authentication filter → JWT token utility: validates tokens with
- HR controllers → Request / response DTOs: accepts and returns
- HR controllers → Global exception handler: errors handled by
- HR controllers → Employee service: delegates employee operations
- HR controllers → Attendance and overtime: delegates attendance operations
- HR controllers → Leave workflow: delegates leave operations
- HR controllers → Payroll workflow: delegates payroll operations
- Employee service → Employee-created event: publishes on creation
- Employee service → Entity / DTO mappers: maps through
- Leave workflow → Entity / DTO mappers: maps through
- Payroll workflow → Entity / DTO mappers: maps through
- Employee service → HR repositories: coordinates
- Attendance and overtime → HR repositories: coordinates
- Leave workflow → HR repositories: coordinates
- Payroll workflow → HR repositories: coordinates
- HR repositories → HR entities: persists
- HR repositories → Relational database: reads and writes
- Audit aspect and interceptor → Employee service: audits
- Audit aspect and interceptor → Leave workflow: audits
- Audit aspect and interceptor → Payroll workflow: audits