|
26 | 26 | | 審核工作流 | 管理員核准 / 拒絕、備注填寫、全部記錄查詢 | |
27 | 27 | | 保養管理 | 保養紀錄新增 / 查詢、到期日提醒 | |
28 | 28 | | 違規管理 | 還車超時自動登錄、管理員 / 主管手動登錄(車損、違停、交通違規等) | |
| 29 | +| 通知收件夾 | 站內訊息中心 + 未讀狀態燈,借車事件自動通知相關人(Observer Pattern) | |
| 30 | +| 稽核日誌 | 借車狀態操作自動記錄並持久化,管理員可查詢(Command Pattern) | |
| 31 | +| 帳號安全 | 密碼強度政策、連續登入失敗帳號鎖定 | |
| 32 | +| 資料治理 | 車輛軟刪除與還原,保留資料可追溯 | |
| 33 | +| 申請維護 | 管理員 / 主管撤銷已核准申請、更改申請內容 | |
29 | 34 |
|
30 | 35 | --- |
31 | 36 |
|
|
37 | 42 | | 安全認證 | Spring Security + JJWT | 0.12.6 | |
38 | 43 | | 資料庫 | PostgreSQL + Spring Data JPA | — | |
39 | 44 | | DB 遷移 | Flyway | — | |
| 45 | +| API 文件 | springdoc-openapi(Swagger UI) | 2.6.0 | |
| 46 | +| 健康監控 | Spring Boot Actuator | — | |
40 | 47 | | 前端框架 | Vue 3 + TypeScript | — | |
41 | 48 | | 狀態管理 | Pinia | 2.x | |
42 | 49 | | HTTP 客戶端 | Axios | 1.x | |
|
81 | 88 | │ │ │ ├── controller/ # REST Controllers + GlobalExceptionHandler |
82 | 89 | │ │ │ └── dto/ # Request / Response records |
83 | 90 | │ │ ├── domain/ |
84 | | -│ │ │ ├── model/ # BorrowingRequest, Vehicle, User, MaintenanceRecord |
| 91 | +│ │ │ ├── model/ # BorrowingRequest, Vehicle, User, Notification, AuditLog… |
85 | 92 | │ │ │ ├── state/ # State Pattern: BorrowingState, PendingState, … |
86 | | -│ │ │ ├── role/ # Role, AdminRole, EmployeeRole, RoleFactory, Permission |
87 | | -│ │ │ ├── observer/ # BorrowingEventPublisher, EmailNotificationObserver |
88 | | -│ │ │ └── strategy/ # ConflictCheckStrategy, StrictOverlapStrategy |
89 | | -│ │ ├── service/ # BorrowingService, VehicleService, … |
90 | | -│ │ ├── repository/ # IVehicleRepository, IBorrowingRepository, … |
| 93 | +│ │ │ ├── role/ # Role, AdminRole, EmployeeRole, ManagerRole, RoleFactory |
| 94 | +│ │ │ ├── observer/ # BorrowingEventPublisher, Email/InboxNotificationObserver |
| 95 | +│ │ │ ├── strategy/ # ConflictCheckStrategy, StrictOverlapStrategy, BufferedOverlapDecorator |
| 96 | +│ │ │ ├── chain/ # Chain of Responsibility: BorrowingValidator 責任鏈 |
| 97 | +│ │ │ └── command/ # Command Pattern: ApproveCommand, RejectCommand, … |
| 98 | +│ │ ├── service/ # BorrowingService, NotificationService, AuditService, LoginAttemptService… |
| 99 | +│ │ ├── repository/ # IVehicleRepository, IBorrowingRepository, INotificationRepository… |
91 | 100 | │ │ │ └── inmemory/ # InMemory 實作(單元測試用) |
92 | 101 | │ │ └── infrastructure/ |
93 | 102 | │ │ ├── persistence/ # JPA Entities + Repository Adapters |
94 | | -│ │ └── security/ # JwtUtil, JwtAuthFilter, SecurityConfig |
| 103 | +│ │ ├── security/ # JwtUtil, JwtAuthFilter, SecurityConfig |
| 104 | +│ │ └── config/ # OpenApiConfig(Swagger UI) |
95 | 105 | │ └── test/java/com/vehicle/management/ |
96 | 106 | │ ├── unit/ # BorrowingServiceTest, VehicleServiceTest, … |
97 | 107 | │ └── integration/ # BorrowingControllerTest (WebMvcTest) |
98 | 108 | └── frontend/ |
99 | 109 | └── src/ |
100 | | - ├── api/ # auth.ts / vehicles.ts / borrowings.ts / maintenance.ts |
| 110 | + ├── api/ # auth / vehicles / borrowings / notifications / audit / system… |
101 | 111 | ├── stores/ # auth.ts (Pinia) |
102 | 112 | ├── router/ # index.ts |
103 | | - └── views/ # LoginView / EmployeeBorrowView / Admin views |
| 113 | + └── views/ # LoginView / EmployeeBorrowView / InboxView / AdminAuditView / … |
104 | 114 | ``` |
105 | 115 |
|
106 | 116 | --- |
107 | 117 |
|
108 | 118 | ## 設計模式應用 |
109 | 119 |
|
110 | | -本專案實作了 **6 個 GoF 設計模式**,涵蓋 Behavioral、Structural、Creational 三大分類。 |
| 120 | +本專案實作了 **10 個 GoF 設計模式**,涵蓋 Behavioral、Structural、Creational 三大分類,其中後 4 個(Builder、Chain of Responsibility、Decorator、Command)用於重構既有設計、消除擴充痛點。 |
111 | 121 |
|
112 | 122 | | # | 模式 | 分類 | 主要類別 | |
113 | 123 | |---|------|------|---------| |
114 | 124 | | 1 | [State](#1-state-pattern--借車申請生命週期) | Behavioral | `BorrowingRequest`, `BorrowingState`, `PendingState`… | |
115 | | -| 2 | [Observer](#2-observer-pattern--借車事件通知) | Behavioral | `BorrowingEventPublisher`, `EmailNotificationObserver` | |
| 125 | +| 2 | [Observer](#2-observer-pattern--借車事件通知) | Behavioral | `BorrowingEventPublisher`, `EmailNotificationObserver`, `InboxNotificationObserver` | |
116 | 126 | | 3 | [Strategy](#3-strategy-pattern--時段衝突檢查) | Behavioral | `ConflictCheckStrategy`, `StrictOverlapStrategy` | |
117 | 127 | | 4 | [Template Method](#4-template-method-pattern--服務層權限守衛) | Behavioral | `AbstractProtectedService`, `VehicleService`, `MaintenanceService` | |
118 | 128 | | 5 | [Factory Method](#5-factory-method-pattern--角色建立) | Creational | `RoleFactory`, `AdminRole`, `EmployeeRole`, `ManagerRole` | |
119 | 129 | | 6 | [Adapter](#6-adapter-pattern--repository-橋接) | Structural | `*RepositoryAdapter`, `Jpa*Repo` | |
| 130 | +| 7 | [Builder](#7-builder-pattern--借車申請物件建構63) | Creational | `BorrowingRequest.Builder` | |
| 131 | +| 8 | [Chain of Responsibility](#8-chain-of-responsibility-pattern--借車申請多步驟驗證64) | Behavioral | `BorrowingValidator`, `PermissionValidator`, `TimeConflictValidator` | |
| 132 | +| 9 | [Decorator](#9-decorator-pattern--可疊加的衝突緩衝策略65) | Structural | `BufferedOverlapDecorator` | |
| 133 | +| 10 | [Command](#10-command-pattern--借車狀態操作稽核66) | Behavioral | `BorrowingCommand`, `BorrowingCommandBus`, `ApproveCommand` | |
120 | 134 |
|
121 | 135 | --- |
122 | 136 |
|
@@ -399,7 +413,7 @@ classDiagram |
399 | 413 |
|
400 | 414 | --- |
401 | 415 |
|
402 | | -### 6. Builder Pattern — 借車申請物件建構([#63](https://github.com/DamnDamnDamnM3/114-2_FCU_Framework-Design-Final/issues/63)) |
| 416 | +### 7. Builder Pattern — 借車申請物件建構([#63](https://github.com/DamnDamnDamnM3/114-2_FCU_Framework-Design-Final/issues/63)) |
403 | 417 |
|
404 | 418 | **問題**:`BorrowingRepositoryAdapter.toDomain()` 從資料庫還原物件時,需呼叫 `r.approve(null); r.startUse();` 等副作用方法重播 State transition,會觸發 Observer 通知且邏輯脆弱。 |
405 | 419 |
|
@@ -436,7 +450,7 @@ classDiagram |
436 | 450 |
|
437 | 451 | --- |
438 | 452 |
|
439 | | -### 7. Chain of Responsibility Pattern — 借車申請多步驟驗證([#64](https://github.com/DamnDamnDamnM3/114-2_FCU_Framework-Design-Final/issues/64)) |
| 453 | +### 8. Chain of Responsibility Pattern — 借車申請多步驟驗證([#64](https://github.com/DamnDamnDamnM3/114-2_FCU_Framework-Design-Final/issues/64)) |
440 | 454 |
|
441 | 455 | **問題**:`BorrowingService.submitRequest()` 依序進行「權限檢查 → 車輛存在 → 時段衝突」三步驗證,邏輯全寫在一個方法中,新增驗證規則需修改 Service 本身(違反 OCP)。 |
442 | 456 |
|
@@ -482,7 +496,7 @@ classDiagram |
482 | 496 |
|
483 | 497 | --- |
484 | 498 |
|
485 | | -### 8. Decorator Pattern — 可疊加的衝突緩衝策略([#65](https://github.com/DamnDamnDamnM3/114-2_FCU_Framework-Design-Final/issues/65)) |
| 499 | +### 9. Decorator Pattern — 可疊加的衝突緩衝策略([#65](https://github.com/DamnDamnDamnM3/114-2_FCU_Framework-Design-Final/issues/65)) |
486 | 500 |
|
487 | 501 | **問題**:若需在現有嚴格重疊策略上加入「借車前後保留 30 分鐘緩衝時間」的規則,直接修改 `StrictOverlapStrategy` 會使其邏輯複雜,且難以在不同情境下選擇是否啟用緩衝。 |
488 | 502 |
|
@@ -512,7 +526,7 @@ classDiagram |
512 | 526 |
|
513 | 527 | --- |
514 | 528 |
|
515 | | -### 9. Command Pattern — 借車狀態操作稽核([#66](https://github.com/DamnDamnDamnM3/114-2_FCU_Framework-Design-Final/issues/66)) |
| 529 | +### 10. Command Pattern — 借車狀態操作稽核([#66](https://github.com/DamnDamnDamnM3/114-2_FCU_Framework-Design-Final/issues/66)) |
516 | 530 |
|
517 | 531 | **問題**:`BorrowingController` 直接呼叫 `borrowingService.approveRequest(...)` 等方法,各操作的稽核日誌、非同步處理等橫切關注點分散在各 endpoint,無法統一管理。 |
518 | 532 |
|
|
0 commit comments