You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A high-concurrency ticket booking backend targeting thousands to tens of thousands of concurrent users. Features show management, seat selection, Redis-based inventory, order timeout cancellation, mock payment, venue check-in verification, and partial refunds. Built with a Maven multi-module architecture for independent deployment.
Features
Show Management — CRUD for shows / sessions / seats; admin warms up seat inventory into Redis with one click
Venue Templates — Define seat layout and default prices once on a room; sessions created with a roomId auto-copy all seats and price areas instantly
Booking Core — Lua atomic purchase-limit check + Redis batch seat lock (full rollback on any failure) + synchronous order creation
Creates 1 venue template (20 × 20 seats, VIP front section), 5 shows, 15 sessions, then publishes and warms up all sessions into Redis. Total: 6 000 bookable seats ready for load testing.
API Overview
User Service (:8082)
Auth
Method
Path
Description
Auth
POST
/api/auth/register
Register
✗
POST
/api/auth/login
Login, returns JWT
✗
Shows
Method
Path
Description
Auth
POST
/api/show/list
Published show list (paginated, filterable by name / category / venue)
✗
GET
/api/show/{id}
Show detail
✗
Sessions
Method
Path
Description
Auth
POST
/api/session/list
Session list (paginated, filterable by status / startTime / endTime)
Lock seats + create order, returns full order immediately
✓
POST
/api/order/cancel
Cancel order (unpaid: sync cancel; paid / partial-refund: initiate refund)
✓
GET
/api/order/orderDetails
Order detail (owner only)
✓
POST
/api/order/refundTicket
Refund a single ticket (works on paid or partially-refunded orders)
✓
POST
/api/order/list
My orders (paginated, filterable by status / date range)
✓
Payment & Verification
Method
Path
Description
Auth
POST
/api/payment/create
Pay order
✓
POST
/api/verify/qr
Verify by QR code
✗
POST
/api/verify/ticket
Verify by ticket number
✗
Admin Service (:8081)
Venue Templates (Room Management)
Define the seat layout and default prices on a room once; specifying roomId when creating a session automatically copies all seats and price areas.
Method
Path
Description
POST
/api/admin/room/create
Create room
PUT
/api/admin/room/update
Update room
GET
/api/admin/room/{id}
Room detail
GET
/api/admin/room/list
Room list
POST
/api/admin/room/seat/batch
Save room seat template (overwrite)
GET
/api/admin/room/seat/list?roomId=
Room seat template list
POST
/api/admin/room/area/save
Save room default price areas (overwrite)
GET
/api/admin/room/area/list?roomId=
Room default price area list
Shows & Sessions
Method
Path
Description
POST
/api/admin/show/create
Create show
PUT
/api/admin/show/update
Update show
GET
/api/admin/show/{id}
Show detail
GET
/api/admin/show/list
Show list
POST
/api/admin/session/create
Create session (pass roomId to auto-copy seats + prices)
PUT
/api/admin/session/update
Update session
GET
/api/admin/session/{id}
Session detail
GET
/api/admin/session/list?showId=
Session list
PUT
/api/admin/session/{sessionId}/publish
Publish session for sale
Seats (Manual — use when no room template)
Method
Path
Description
POST
/api/admin/seat/batch
Batch create seats
GET
/api/admin/seat/list?sessionId=
Seat list
POST
/api/admin/seat/area/save
Save session price areas
GET
/api/admin/seat/area/list?sessionId=
Session price area list
POST
/api/admin/seat/warmup/{sessionId}
Warm up seat inventory into Redis
Orders & Monitor
Method
Path
Description
GET
/api/admin/order/{id}
Order detail
GET
/api/admin/order/query
Order query
GET
/api/admin/order/{id}/items
Order line items
GET
/api/admin/monitor/dashboard?sessionId=
Real-time seat counts (total / available / sold)
Core Booking Flow
User submits seat selection
│
├─ @RateLimit blacklist / IP / user / global check (AOP, first to intercept)
├─ Session validation
├─ Lua atomic purchase-limit check (Redis)
├─ Lua batch seat lock (full rollback on any failure)
├─ Synchronous order creation (DB INSERT)
├─ Send timeout message to RabbitMQ (TTL = 5 min)
└─ Return full order info (show / session / seats / total / countdown)
│
┌───────────┴───────────┐
│ │
User clicks Pay on No payment within 5 min
confirmation page │
│ Timeout message routed via DLX
POST /api/payment/create to order.cancel.queue
│ │
├─ Create payment record Cancel order
├─ Order status → PAID Release Redis inventory
└─ Send payment event Roll back purchase count
│
┌─────────┼──────────┐
│ │ │
Generate Sync DB Send notification
Tickets inventory (reserved)
(async) (async)
Refund Flow
Order status: 1 (PAID) or 5 (PARTIAL_REFUND)
│
├─ Full cancel POST /api/order/cancel
│ └─ Find all unused tickets → doRefund → status → REFUNDING (3)
│
└─ Per-ticket POST /api/order/refundTicket
└─ Validate ticket is unused → doRefund → status → REFUNDING (3)
│
MQ consumer processes refund result
│
┌───────────┴───────────┐
│ │
Unused tickets remain All tickets refunded
status → PARTIAL_REFUND (5) status → REFUNDED (4)