feat(admin): Add user management and upgrade to module permission system

Features - User Management (Phase 4.1):
- Database: Add user_modules table for fine-grained module permissions
- Database: Add 4 user permissions (view/create/edit/delete) to role_permissions
- Backend: UserService (780 lines) - CRUD with tenant isolation
- Backend: UserController + UserRoutes (648 lines) - 13 API endpoints
- Backend: Batch import users from Excel
- Frontend: UserListPage (412 lines) - list/filter/search/pagination
- Frontend: UserFormPage (341 lines) - create/edit with module config
- Frontend: UserDetailPage (393 lines) - details/tenant/module management
- Frontend: 3 modal components (592 lines) - import/assign/configure
- API: GET/POST/PUT/DELETE /api/admin/users/* endpoints

Architecture Upgrade - Module Permission System:
- Backend: Add getUserModules() method in auth.service
- Backend: Login API returns modules array in user object
- Frontend: AuthContext adds hasModule() method
- Frontend: Navigation filters modules based on user.modules
- Frontend: RouteGuard checks requiredModule instead of requiredVersion
- Frontend: Remove deprecated version-based permission system
- UX: Only show accessible modules in navigation (clean UI)
- UX: Smart redirect after login (avoid 403 for regular users)

Fixes:
- Fix UTF-8 encoding corruption in ~100 docs files
- Fix pageSize type conversion in userService (String to Number)
- Fix authUser undefined error in TopNavigation
- Fix login redirect logic with role-based access check
- Update Git commit guidelines v1.2 with UTF-8 safety rules

Database Changes:
- CREATE TABLE user_modules (user_id, tenant_id, module_code, is_enabled)
- ADD UNIQUE CONSTRAINT (user_id, tenant_id, module_code)
- INSERT 4 permissions + role assignments
- UPDATE PUBLIC tenant with 8 module subscriptions

Technical:
- Backend: 5 new files (~2400 lines)
- Frontend: 10 new files (~2500 lines)
- Docs: 1 development record + 2 status updates + 1 guideline update
- Total: ~4900 lines of code

Status: User management 100% complete, module permission system operational
This commit is contained in:
2026-01-16 13:42:10 +08:00
parent 98d862dbd4
commit 66255368b7
560 changed files with 70424 additions and 52353 deletions

View File

@@ -1,48 +1,48 @@
# 閫氱敤鑳藉姏灞?
# 通用能力层
> **灞傜骇瀹氫箟锛?* 璺ㄤ笟鍔℃ā鍧楀叡浜<E58FA1>殑鏍稿績鎶€鏈<E282AC>兘鍔?
> **鏍稿績鍘熷垯锛?* 鍙<><E98D99>鐢ㄣ€侀珮鍐呰仛銆佺嫭绔嬮儴缃?
> **层级定义:** 跨业务模块共享的核心技术能力
> **核心原则:** 可复用、高内聚、独立部署
---
## 📋 能力清单
| 鑳藉姏 | 璇存槑 | 澶嶇敤鐜?| 浼樺厛绾?| 鐘舵€?|
| 能力 | 说明 | 复用率 | 优先级 | 状态 |
|------|------|-------|--------|------|
| **01-LLM澶фā鍨嬬綉鍏?* | 缁熶竴绠悊LLM璋冪敤銆佹垚鏈<E59E9A>帶鍒躲€佹ā鍨嬪垏鎹?| 71% (5/7) | P0 | 鈴?寰呭疄鐜?|
| **02-鏂囨。澶勭悊寮曟搸** | PDF/Docx/Txt鎻愬彇銆丱CR銆佽〃鏍兼彁鍙?| 86% (6/7) | P0 | 鉁?宸插疄鐜?|
| **03-RAG寮曟搸** | 鍚戦噺妫€绱€€佽<EFBFBD>涔夋悳绱€€丷AG闂<EFBFBD> | 43% (3/7) | P1 | 鉁?宸插疄鐜?|
| **04-鏁版嵁ETL寮曟搸** | Excel JOIN銆佹暟鎹<EFBFBD>竻娲椼€佹暟鎹<EFBFBD>浆鎹?| 29% (2/7) | P2 | 鈴?寰呭疄鐜?|
| **05-鍖诲<EFBFBD>NLP寮曟搸** | 鍖诲<E98D96>瀹炰綋璇嗗埆銆佹湳璇<E6B9B3>爣鍑嗗寲 | 14% (1/7) | P2 | 鈴?寰呭疄鐜?|
| **01-LLM大模型网关** | 统一管理LLM调用、成本控制、模型切换 | 71% (5/7) | P0 | ⏳ 待实现 |
| **02-文档处理引擎** | PDF/Docx/Txt提取、OCR、表格提取 | 86% (6/7) | P0 | ✅ 已实现 |
| **03-RAG引擎** | 向量检索、语义搜索、RAG问答 | 43% (3/7) | P1 | ✅ 已实现 |
| **04-数据ETL引擎** | Excel JOIN、数据清洗、数据转换 | 29% (2/7) | P2 | ⏳ 待实现 |
| **05-医学NLP引擎** | 医学实体识别、术语标准化 | 14% (1/7) | P2 | ⏳ 待实现 |
---
## 🎯 设计原则
### 1. <EFBFBD><EFBFBD>鐢ㄦ€?
### 1. 可复用性
- 多个业务模块共享
- 閬垮厤閲嶅<EFBFBD>寮€鍙?
- 避免重复开发
### 2. 独立部署
- 可以独立为微服务
- 支持独立扩展
### 3. 楂樺唴鑱?
### 3. 高内聚
- 每个能力职责单一
- 接口清晰
### 4. 领域知识
- 包含业务领域知识
- 涓嶆槸绾<EFBFBD>妧鏈<EFBFBD>粍浠?
- 不是纯技术组件
---
## 馃搳 澶嶇敤鐜囧垎鏋?
## 📊 复用率分析
**LLM缃戝叧** - 71%澶嶇敤鐜囷紙鏈€楂樹紭鍏堢骇锛?
- AIA锛圓I鏅鸿兘闂<EFBFBD>瓟锛?
- ASL锛圓I鏅鸿兘鏂囩尞锛?
- PKB锛堜釜浜虹煡璇嗗簱锛?
**LLM网关** - 71%复用率(最高优先级)
- AIAAI智能问答
- ASLAI智能文献
- PKB(个人知识库)
- DC数据清洗
- RVW稿件审查
@@ -54,15 +54,15 @@
---
## 馃摎 蹇<>€熷<E282AC>鑸?
## 📚 快速导航
### 快速上下文
- **[AI瀵规帴] 閫氱敤鑳藉姏蹇<E5A78F>€熶笂涓嬫枃.md** - 2-3鍒嗛挓浜嗚В閫氱敤鑳藉姏灞?
- **[AI对接] 通用能力快速上下文.md** - 2-3分钟了解通用能力层
### 核心能力
1. [LLM澶фā鍨嬬綉鍏砞(./01-LLM澶фā鍨嬬綉鍏?README.md) - P0浼樺厛绾?猸?
2. [鏂囨。澶勭悊寮曟搸](./02-鏂囨。澶勭悊寮曟搸/README.md) - 宸插疄鐜?
3. [RAG寮曟搸](./03-RAG寮曟搸/README.md) - 宸插疄鐜?
1. [LLM大模型网关](./01-LLM大模型网关/README.md) - P0优先级 ⭐
2. [文档处理引擎](./02-文档处理引擎/README.md) - 已实现
3. [RAG引擎](./03-RAG引擎/README.md) - 已实现
4. [数据ETL引擎](./04-数据ETL引擎/README.md)
5. [医学NLP引擎](./05-医学NLP引擎/README.md)
@@ -71,7 +71,7 @@
## 🔗 相关文档
- [系统架构分层设计](../00-系统总体设计/01-系统架构分层设计.md)
- [骞冲彴鍩虹<EFBFBD>灞俔(../01-骞冲彴鍩虹<E98DA9>灞?README.md)
- [平台基础层](../01-平台基础层/README.md)
- [业务模块层](../03-业务模块/README.md)
---