Files
urbanLifeline/README.md
2025-12-02 15:55:30 +08:00

227 lines
5.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 泰豪电源 AI 数智化平台
城市生命线智能管理系统 - Urban Lifeline
## 项目简介
基于 **"一个底座、多种智能体"** 架构的企业级 AI 数智化平台,包含四大核心业务模块:
1. **资料管理智能化** - 智能文档管理与检索
2. **招投标自动化** - 招投标全流程智能化
3. **售后客服智能化** - AI 驱动的智能客服系统
4. **企业内部知识协同** - 知识库管理与协作
## 技术架构
### 后端技术栈
- **Java 21** + **Spring Boot 3.5**
- **Spring Cloud Gateway** - API 网关
- **Nacos** - 服务注册与配置中心
- **PostgreSQL 16** - 主数据库
- **Redis 7** - 缓存
- **Dubbo 3.3** - RPC 框架
### 前端技术栈
- **Vue 3.5** (`<script setup>`)
- **TypeScript 5.7**
- **Vite 6.0** - 构建工具
- **Pinia 2.2** - 状态管理
- **Element Plus 2.9** - UI 组件库
- **pnpm 9.0 + Turborepo 2.0** - Monorepo 管理
### 核心特性:共享组件 HTTP 导入
采用 **Import Maps + ES Module** 方案,实现真正的运行时组件共享:
```vue
<script setup lang="ts">
// 直接从 HTTP URL 导入共享组件
import { UlTable } from '@shared/components' // → http://localhost/shared/components.js
import { http } from '@shared/utils' // → http://localhost/shared/utils.js
import { authApi } from '@shared/api' // → http://localhost/shared/api.js
</script>
```
**工作原理**
1. 共享包构建为 ES Module (`components.js`)
2. 部署到独立 HTTP 服务 (`http://localhost:5000`)
3. 通过 Nginx 统一代理 (`http://localhost/shared/`)
4. 浏览器通过 Import Maps 直接加载
## 快速开始
### 方式一Docker Compose推荐
```bash
# 1. 启动所有服务(自动构建)
make up
# 2. 等待服务启动约1-2分钟
make ps
# 3. 访问应用
open http://localhost
```
### 方式二:本地开发
```bash
# 1. 安装依赖
pnpm install
# 2. 启动后端服务(需要 Java 21
cd urbanLifelineServ
mvn spring-boot:run
# 3. 启动前端服务
cd urbanLifelineWeb
pnpm dev
# 4. 访问
open http://localhost:3000
```
## 项目结构
```
urbanLifeline/
├── urbanLifelineServ/ # 后端服务Spring Boot
│ ├── gateway/ # API 网关
│ ├── auth/ # 认证服务
│ ├── system/ # 系统服务
│ ├── file/ # 文件服务
│ └── common/ # 公共模块
├── urbanLifelineWeb/ # 前端应用Vue 3 Monorepo
│ ├── packages/
│ │ ├── shared/ # 共享组件库
│ │ │ ├── components/ # 公共组件
│ │ │ ├── utils/ # 工具函数
│ │ │ ├── api/ # API 封装
│ │ │ └── composables/ # 组合式函数
│ │ ├── portal/ # 主应用
│ │ ├── app-bidding/ # 招投标应用
│ │ └── app-knowledge/ # 知识协同应用
│ ├── pnpm-workspace.yaml
│ └── turbo.json
├── docker-compose.dev.yml # Docker 开发环境
├── Makefile # 快捷命令
└── docs/ # 文档
├── 前端完整指南.md # ⭐ 前端全流程文档
└── 数据库设计文档.md # ⭐ 数据库全流程文档
```
## 访问地址
| 应用 | 地址 | 说明 |
|------|------|------|
| **主应用** | http://localhost/ | Portal 统一入口 |
| **招投标** | http://localhost/bidding | 招投标智能体 |
| **智能客服** | http://localhost/customer-service | 客服系统 |
| **共享组件** | http://localhost/shared/components.js | ES Module |
| **API 网关** | http://localhost/api | Gateway |
| **Nacos** | http://localhost/nacos | 注册中心 |
## 常用命令
```bash
# Docker 环境
make up # 启动所有服务
make down # 停止所有服务
make logs # 查看日志
make ps # 查看服务状态
make restart # 重启服务
make clean # 清理所有数据
# 单独服务
make logs-portal # 查看主应用日志
make logs-gateway # 查看网关日志
make restart-portal # 重启主应用
make shell-portal # 进入容器
make db # 连接数据库
# 前端开发
pnpm dev # 启动所有应用
pnpm build # 构建所有应用
pnpm --filter portal dev # 启动单个应用
pnpm --filter portal build # 构建单个应用
```
## 文档索引
- **[前端完整指南](./docs/前端完整指南.md)** - ⭐ 架构、开发、部署全流程
- **[数据库完整指南](./docs/数据库完整指南.md)** - ⭐ Schema、表结构、优化方案
## 核心亮点
### 1. 共享组件运行时加载
```html
<!-- index.html -->
<script type="importmap">
{
"imports": {
"@shared/components": "http://localhost/shared/components.js",
"@shared/utils": "http://localhost/shared/utils.js"
}
}
</script>
```
```vue
<script setup lang="ts">
// 浏览器自动从 URL 加载,无需打包!
import { UlTable } from '@shared/components'
</script>
```
### 2. Monorepo + Turborepo
- 统一依赖管理
- 增量构建加速
- 任务并行执行
- 远程缓存
### 3. Docker 一键启动
- 所有服务容器化
- Nginx 统一网关
- 支持热更新HMR
- 数据持久化
### 4. TypeScript 全栈
- 类型安全
- 智能提示
- 重构友好
## 环境要求
### Docker 环境(推荐)
- Docker 20.10+
- Docker Compose 2.0+
### 本地开发
- Node.js 20+
- pnpm 9+
- Java 21+
- Maven 3.9+
- PostgreSQL 16+
## 开发规范
- **前端**ESLint + Prettier + Husky
- **提交规范**Conventional Commits
- **分支策略**Git Flow
- **代码审查**:必须 Code Review
## License
MIT
---
**Built with ❤️ by Taihao Team**