# Central Platform - 企业级微服务脚手架 [![Java](https://img.shields.io/badge/Java-17-orange.svg)](https://www.oracle.com/java/) [![Spring Boot](https://img.shields.io/badge/Spring%20Boot-3.1.6-brightgreen.svg)](https://spring.io/projects/spring-boot) [![Spring Cloud](https://img.shields.io/badge/Spring%20Cloud-2022.0.4-blue.svg)](https://spring.io/projects/spring-cloud) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) ## 项目简介 Central Platform 是一个基于 Spring Cloud 的企业级微服务脚手架,提供完整的微服务基础设施和通用业务模块,帮助快速构建企业级应用。 ### 核心特性 - ✅ **微服务架构** - 基于 Spring Cloud 2022.0.4 - ✅ **服务治理** - Nacos 服务注册发现与配置中心 - ✅ **API 网关** - Spring Cloud Gateway + Sentinel 限流熔断 - ✅ **认证授权** - OAuth2 + JWT + Spring Security - ✅ **多租户支持** - 完整的多租户数据隔离方案 - ✅ **分布式缓存** - Redis + Redisson 分布式锁 - ✅ **数据库** - MyBatis Plus + 多数据源 - ✅ **全文搜索** - Elasticsearch 集成 - ✅ **文件存储** - 多云存储支持(阿里云OSS、七牛云、MinIO) - ✅ **监控中心** - Spring Boot Admin 应用监控 - ✅ **代码生成** - 基于数据库表的代码生成器 ## 技术栈 | 技术 | 版本 | 说明 | |------|------|------| | Java | 17 | 编程语言 | | Spring Boot | 3.1.6 | 应用框架 | | Spring Cloud | 2022.0.4 | 微服务框架 | | Spring Cloud Alibaba | 2022.0.0.0 | 阿里云组件 | | MyBatis Plus | 3.5.4.1 | ORM 框架 | | MySQL | 8.0+ | 关系数据库 | | Redis | 7.0+ | 缓存数据库 | | Elasticsearch | 7.13.4 | 搜索引擎 | | Nacos | Latest | 注册中心/配置中心 | | Sentinel | Latest | 限流熔断 | ## 模块说明 ```lua central-platform -- 父项目,公共依赖 │ ├─zlt-business -- 业务模块一级工程 │ │ ├─user-center -- 用户中心[7000] │ │ ├─file-center -- 文件中心[5000] │ │ ├─search-center -- 搜索中心 │ │ │ ├─search-client -- 搜索中心客户端 │ │ │ ├─search-server -- 搜索中心服务端[7100] │ │ ├─code-generator -- 代码生成器[7300] │ │ └─demo-center -- 示例模块[8100] │ ├─zlt-commons -- 通用工具一级工程 │ │ ├─zlt-common-core -- 核心工具类 │ │ ├─zlt-common-spring-boot-starter -- 通用配置 │ │ ├─zlt-db-spring-boot-starter -- 数据库集成 │ │ ├─zlt-redis-spring-boot-starter -- Redis集成 │ │ ├─zlt-log-spring-boot-starter -- 日志集成 │ │ ├─zlt-auth-client-spring-boot-starter -- 认证客户端 │ │ ├─zlt-loadbalancer-spring-boot-starter -- 负载均衡 │ │ ├─zlt-sentinel-spring-boot-starter -- 限流熔断 │ │ ├─zlt-elasticsearch-spring-boot-starter -- 搜索引擎 │ │ ├─zlt-oss-spring-boot-starter -- 对象存储 │ │ ├─zlt-sms-spring-boot-starter -- 短信集成 │ │ ├─zlt-zookeeper-spring-boot-starter -- Zookeeper集成 │ │ ├─zlt-wechat-common-core -- 微信通用核心 │ │ └─zlt-wechat-spring-boot-starter -- 微信集成 │ ├─zlt-gateway -- API网关[9900] │ ├─zlt-uaa -- 认证授权中心[8000] │ ├─zlt-config -- 配置中心 │ ├─zlt-monitor -- 监控中心 │ │ ├─sc-admin -- 应用监控[6500] │ │ └─log-center -- 日志中心[7200] │ └─zlt-doc -- 项目文档 └─database -- 数据库脚本 ``` ## 快速开始 ### 环境要求 - JDK 17+ - Maven 3.6+ - MySQL 8.0+ - Redis 7.0+ - Nacos 2.0+ ### 数据库初始化 ```bash mysql -u root -p < zlt-doc/database/init.sql ``` ### 启动 Nacos ```bash # 单机模式启动 sh nacos/bin/startup.sh -m standalone ``` 访问: http://localhost:8848/nacos (账号: nacos/nacos) ### 编译项目 ```bash mvn clean install -DskipTests ``` ### 启动服务 1. 启动网关 (9900) 2. 启动认证中心 (8000) 3. 启动用户中心 (7000) 4. 启动文件中心 (5000) ### 默认账号 - 用户名: `admin` - 密码: `admin123` ## 许可证 Apache License 2.0