Spring Boot 3 + Vue 3 Course Selection System Replaces First-Come with Public-Seed Lottery
This is a concrete reference implementation for fair, auditable seat or resource allocation without concurrency contention, useful for any system that must be both equitable and explainable. The public-seed recomputation design carries real trust value in educational settings and beyond.
The project, by 黃芢輝, implements a full registrar-grade elective course management system. Students submit wishes with an order and points budget during a filling window; after the deadline, a batch lottery allocates seats in memory without concurrency locks, then writes results transactionally. The draw seed is public, and input snapshots are gzip+SHA-256 hashed, so third parties can recompute outcomes. Per-wish results record hit/miss reasons and placement order, giving students a clear audit trail.
The backend runs Java 21 with Spring Boot 3.3.5, MyBatis-Plus, MySQL 8, and Redis 7 (used only for token whitelist, draw lock, and heat snapshot — not for seat counts). The frontend is Vue 3.5 with Element Plus, Pinia, and ECharts. The admin console provides a draw phase machine, batch reports, grade entry with per-student corrections and audit logs, plus a 22-table schema. It includes a Docker Compose one-click startup and a native WeChat mini-program that reuses the same APIs.
Two branches exist: `master` uses Redis+Lua for real-time rush, while `feature/wish-lottery-selection` (the one described) favors fairness and reproducibility. The author explicitly avoids caching seat numbers, reruns are idempotent (old batches marked SUPERSEDED), and submission time never influences weighting.
By making the seed public and snapshots gzip+SHA-256, the system turns a lottery into a verifiable computation, which is a strong trust signal in an academic environment where fairness is paramount.
Keeping seat counts solely in the database sidesteps the classic cache-coherency nightmares of flash-sale style systems, at the cost of a draw that is inherently batch-based rather than real-time.
The soft constraint that only warns on timetable conflicts between wishes preserves the 'A misses, fall to B' logic, a design choice that prevents over-constraining a fair lottery.
The explicit split into two branches lets developers compare real-time rush and lottery approaches in the same codebase, which is a rare educational opportunity.