erp-java/README.md
2026-04-06 21:17:14 +08:00

112 lines
2.6 KiB
Markdown
Raw Permalink 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.

# ERP Java 微服务
## 项目简介
ERP系统的Java微服务版本采用Spring Cloud微服务架构。
## 技术栈
- **框架**: Spring Boot 3.x, Spring Cloud 2023
- **数据库**: MySQL 8.0, Redis 7
- **消息队列**: RocketMQ
- **服务注册**: Nacos
- **ORM**: MyBatis Plus, JPA
- **构建工具**: Maven 3.8+
- **Java版本**: JDK 17+
## 项目结构
```
├── common/ # 公共模块
│ ├── common-config/ # 配置模块
│ ├── common-core/ # 核心实体
│ ├── common-mybatis/ # MyBatis增强
│ ├── common-redis/ # Redis封装
│ └── common-web/ # Web增强
├── gateway/ # 网关服务
├── services/ # 业务服务
│ ├── user-service/ # 用户服务
│ ├── order-service/ # 订单服务
│ ├── product-service/ # 商品服务
│ ├── inventory-service/ # 库存服务
│ ├── finance-service/ # 财务服务
│ └── ...
├── nacos/ # Nacos配置
├── rocketmq/ # RocketMQ配置
├── seata/ # Seata分布式事务
└── deploy/ # 部署脚本
```
## 快速开始
### 环境要求
- JDK 17+
- Maven 3.8+
- MySQL 8.0
- Redis 7
- Nacos (可选)
- RocketMQ (可选)
### 构建
```bash
# 全量构建
mvn clean package -DskipTests
# 单服务构建
cd services/user-service
mvn clean package -DskipTests
```
### 配置
修改 `services/*/src/main/resources/application.yml` 中的数据库和Redis配置。
### 运行
```bash
# 运行单个服务
java -jar services/user-service/target/user-service.jar
# 使用Docker运行
docker-compose up -d
```
## 服务列表
| 服务 | 端口 | 说明 |
|------|------|------|
| user-service | 8082 | 用户认证服务 |
| order-service | 8084 | 订单服务 |
| product-service | 8083 | 商品服务 |
| inventory-service | 8085 | 库存服务 |
| tenant-service | 8086 | 租户服务 |
| permission-service | 8087 | 权限服务 |
| dashboard-service | 8088 | 仪表盘服务 |
## API文档
启动服务后访问: http://localhost:服务端口/swagger-ui.html
## 开发指南
### 新增服务
1.`services/` 下创建新服务模块
2. 参考已有服务的pom.xml配置
3. 添加到根pom.xml的modules中
4. 创建数据库表和实体类
5. 实现Controller, Service, Repository层
### 代码规范
- 遵循阿里巴巴Java开发规范
- 使用Lombok简化代码
- 所有API返回统一格式: ApiResponse<T>
- 分页查询使用PageResponse<T>
## 许可证
私有项目,仅限内部使用