An open-source attendance and duty scheduling system for real-world shift scenarios, including:
- Organization and permission management (department, user, role, menu)
- Scheduling (shift definitions and duty schedules)
- Attendance (devices, punch records, attendance results)
- Rule engine (DSL/SpEL)
- Scheduled jobs and E2E automation scripts
This project is refactored from a production legacy attendance system.
The roadmap also includes AI assistant, duty bulletin/public board, and data analytics sub-systems.
- A runnable full-stack system (
attendance-backend+attendance-frontend) - Not just a docs/demo repo: docs and scripts are support materials for the running product
- The rule engine is an integrated production module, used in real attendance result calculation
- Replace manual attendance tracking in small and medium-sized organizations
- Standardize scheduling, punch-in/out ingestion, attendance result generation, and rule-based judgment
- Provide an extensible base for organizations that need customizable attendance rules
- If you only run backend + database, you can already use the core APIs and Swagger
- If you also run frontend, you get an end-to-end usable admin UI
- If you run scripts in
scripts/, you can validate the full attendance flow automatically
# 1) optional: set host ports when 3306/8080 are occupied
# export MYSQL_PORT=3308
# export BACKEND_PORT=18082
# 2) start backend + mysql
docker compose up -d
# 3) open swagger
# default: http://localhost:8080/swagger-ui.html
# custom: http://localhost:<BACKEND_PORT>/swagger-ui.html- Backend:
Spring Boot 3,JDK 21,MyBatis-Plus,Spring Security,JWT - Frontend:
Vue 3,Vite,Element Plus - Database:
MySQL 8+
cola-attendance/
|-- attendance-backend/ # Java backend
|-- attendance-frontend/ # Vue frontend
|-- docs/ # DB scripts, design docs, E2E docs
|-- scripts/ # E2E automation (Python + PowerShell)
|-- docker-compose.yml # Local/demo orchestration
`-- TASKS.md # Project task list and progress
- Auth and access control: JWT-based login, request header uses
token - System module: CRUD for department/user/role/menu, with tree structure support
- Scheduling module: shift management, schedule maintenance, batch scheduling/cancel
- Attendance module: device management, punch records (including Excel import and device callback), attendance results
- Rule engine: configurable attendance decision rules through DSL (SpEL)
- Scheduled jobs:
- Generate empty attendance records daily at
01:00 - Run end-of-day supplement daily at
23:55
- Generate empty attendance records daily at
- JDK 21
- Maven 3.8+
- MySQL 8+
- Node.js 18+ (frontend only)
- Run schema scripts:
docs/attendance-db-schema.sqldocs/attendance-db-schema-alter.sql
- Initialize admin user:
attendance-backend/src/main/resources/sql/init-admin.sql
Default admin account:
- Username:
admin - Password:
123456
cd attendance-backend
mvn spring-boot:run -Dspring-boot.run.profiles=devAvailable after startup:
- Swagger:
http://localhost:8080/swagger-ui.html
cd attendance-frontend
npm install
npm run devDefault URL: http://localhost:5173
Dev proxy: /api -> http://localhost:8080 (see attendance-frontend/vite.config.js)
docker compose up -dNotes:
- Starts
mysqlandbackend - MySQL first-time init is automatic (runs SQL in
/docker-entrypoint-initdb.d):docs/attendance-db-schema.sqldocs/attendance-db-schema-alter.sqlattendance-backend/src/main/resources/sql/init-admin.sql
- Default host ports:
- MySQL:
3306(from${MYSQL_PORT:-3306}) - Backend:
8080(from${BACKEND_PORT:-8080})
- MySQL:
- If ports are occupied on your machine, run with custom ports:
MYSQL_PORT=3308 BACKEND_PORT=18082 docker compose up -d- Then use:
- Backend URL:
http://localhost:<BACKEND_PORT> - Swagger:
http://localhost:<BACKEND_PORT>/swagger-ui.html
- Backend URL:
- If you need to re-run DB init scripts, remove volume and recreate:
docker compose down -v
docker compose up -dInstall dependencies:
pip install -r scripts/requirements.txtRun one full cycle:
.\scripts\full_link_cycle.ps1 -Cycles 1 -Date 2025-02-05 -SampleCount 5 -ReportDir logsFlow includes:
- Cleanup test data
- Auto scheduling
- Punch simulation and rule triggering
- End-of-day supplement
- Correctness verification with report output
Details: docs/e2e-attendance-test.md
Use environment variables for sensitive values:
| Variable | Description | Example |
|---|---|---|
JWT_SECRET |
JWT signing secret (required in production, recommended >= 32 chars) | replace-with-random-secret |
JWT_EXPIRATION_MS |
Token expiration in milliseconds | 86400000 |
SPRING_DATASOURCE_URL |
JDBC URL | jdbc:mysql://mysql:3306/attendance?... |
SPRING_DATASOURCE_USERNAME |
DB username | root |
SPRING_DATASOURCE_PASSWORD |
DB password | strong-password |
Script-related:
COLA_ATTENDANCE_BASE_URL: backend base URL for E2E scripts (defaulthttp://localhost:8080)
- Login endpoint:
POST /system/auth/login - Put login token into request header:
token: <jwt>
Completed:
- Main capabilities in system, schedule, attendance, and rule-engine modules
- E2E automation scripts and docs
Enhancement backlog: TASKS.md
- Contributing guide:
CONTRIBUTING.md - License:
LICENSE