# ai-platform-framework **Repository Path**: JavaBigDataStudy/ai-platform-framework ## Basic Information - **Project Name**: ai-platform-framework - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-31 - **Last Updated**: 2026-01-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 智能化平台框架 基于Spring Boot的企业级智能化平台框架,采用模块化设计和DDD(领域驱动设计)架构。 ## 🏗️ 架构特点 - **基础能力集约化**: 将通用功能抽象为独立的starter模块 - **模块组装标准化**: 基于Spring Boot Auto-Configuration机制 - **业务扩展轻量化**: 按需引入依赖,最小化运行时开销 - **渐进式迭代**: 支持逐步扩展和升级 - **轻量级架构**: 模块解耦,独立部署和扩展 ## 📁 项目结构 ``` intelligent-platform/ ├── pom.xml # 父项目POM ├── framework-common-starter/ # 通用模块 ├── framework-auth-starter/ # 认证授权模块 ├── framework-data-starter/ # 数据存储模块 ├── framework-log-starter/ # 日志追踪模块 ├── framework-ai-starter/ # AI能力模块 ├── framework-iot-adapter-starter/ # IoT适配模块 ├── framework-ext-api-starter/ # 扩展接口模块 ├── gateway/ # 网关服务 └── business-paper/ # 组卷业务示例 ``` ## 🚀 快速开始 ### 环境要求 - JDK 17+ - Maven 3.6+ - MySQL 8.0+ - Redis 6.0+ - Milvus 2.3+ ### 启动服务 **Windows环境:** ```bash # 执行启动脚本 start.bat ``` **Linux/Mac环境:** ```bash # 赋予执行权限 chmod +x start.sh # 执行启动脚本 ./start.sh ``` ### 服务端口 - **网关服务**: http://localhost:8080 - **组卷业务**: http://localhost:8081/paper ## 📚 模块说明 ### 1. framework-common-starter 提供通用功能: - 统一响应结果封装 (`Result`) - 全局异常处理 (`GlobalExceptionHandler`) - 业务异常定义 (`BusinessException`) - 分页请求封装 (`PageRequest`) **使用方式:** ```java @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } ``` ### 2. framework-auth-starter 认证授权功能: - JWT Token管理 (`JwtTokenProvider`) - 用户权限服务 (`AuthService`) - 认证拦截器 (`AuthInterceptor`) **配置示例:** ```yaml jwt: secret: your-secret-key expiration: 86400000 # 24小时 ``` ### 3. framework-data-starter 数据存储能力: - Redis缓存 (`RedisTemplate`) - Milvus向量数据库 (`MilvusTemplate`) - 数据访问抽象层 **配置示例:** ```yaml spring: redis: host: localhost port: 6379 milvus: host: localhost port: 19530 database: intelligent_platform ``` ### 4. framework-log-starter 日志追踪功能: - 请求响应日志 (`RequestResponseInterceptor`) - 操作日志记录 (`OperationLogger`) - 链路追踪 (`TraceContext`) ### 5. framework-ai-starter AI能力集成: - 大语言模型客户端 (`OllamaClient`) - AI服务封装 (`AiService`) - 对话模型 (`ChatRequest/Response`) **配置示例:** ```yaml ai: ollama: base-url: http://localhost:11434 model: llama2 timeout: 30000 ``` ### 6. framework-iot-adapter-starter IoT设备适配: - MQTT通信 (`MqttService`) - 设备管理 (`Device`) - WebSocket支持 (`IotWebSocketHandler`) **配置示例:** ```yaml mqtt: broker: tcp://localhost:1883 client-id: iot-service ``` ### 7. framework-ext-api-starter 扩展接口支持: - 大数据服务 (`BigDataService`) - 数据可视化 (`DashboardService`) - 扩展管理器 (`ExtensionManager`) ### 8. Gateway 基于Spring Cloud Gateway的网关服务: - 路由转发 - 认证过滤 - 负载均衡 ## 🎯 业务示例 - 组卷系统 完整的组卷业务实现,展示了如何使用框架构建业务系统: ### 核心功能 - 试卷CRUD操作 - 智能组卷 - 试题管理 - 权限控制 ### API接口 ```bash # 创建试卷 POST http://localhost:8081/paper/api/papers Content-Type: application/json { "name": "期末考试试卷", "description": "数学期末考试", "type": "FORMAL", "totalScore": 100, "duration": 120, "difficulty": "MEDIUM" } # 分页查询试卷 GET http://localhost:8081/paper/api/papers?pageNum=1&pageSize=10 # 智能生成试卷 POST http://localhost:8081/paper/api/papers/generate Content-Type: application/json { "name": "智能生成试卷", "type": "SIMULATION", "totalScore": 100, "difficulty": "MEDIUM", "questionTypeDistribution": [ { "questionType": "SINGLE_CHOICE", "score": 40, "count": 10 } ] } ``` ## 🔧 开发指南 ### 创建新的业务模块 1. 继承父项目POM 2. 引入需要的starter模块 3. 按照DDD结构组织代码 4. 实现业务逻辑 **Maven依赖示例:** ```xml com.intelligent.platform framework-common-starter com.intelligent.platform framework-auth-starter ``` ### 扩展框架能力 1. 创建新的starter模块 2. 实现AutoConfiguration类 3. 添加META-INF配置文件 4. 提供配置属性类 ## 📊 技术栈 - **核心框架**: Spring Boot 3.x, Spring Cloud Gateway - **数据库**: MySQL 8.0, Redis 6.0 - **向量数据库**: Milvus 2.3+ - **消息队列**: MQTT - **AI服务**: Ollama - **监控**: Spring Boot Actuator, SkyWalking - **文档**: OpenAPI 3.0 ## 🚀 部署说明 ### Docker部署 ```dockerfile # 构建镜像 docker build -t intelligent-platform . # 启动容器 docker-compose up -d ``` ### 云平台部署 支持部署到各种云平台: - 阿里云ECS - 腾讯云CVM - 华为云ECS ## 📄 许可证 本项目采用MIT许可证,详见LICENSE文件。 ## 🤝 贡献指南 欢迎提交Issue和Pull Request来完善框架。 ## 📞 联系我们 如有问题,请通过以下方式联系: - 提交Issue - 发送邮件至: dev@intelligent-platform.com