# Customer Service
客户关系管理服务 - 客户管理、跟进、联系人、地址、统计分析

## 基本信息
- **服务端口**: 8086
- **服务名称**: customer-service
- **模块分支**: 业务域/功能模块
- **数据库**: erp_db

## 功能清单
1. 客户信息管理
2. 客户统计分析

## API接口
| 方法 | 路径 | 描述 |
|------|------|------|
| GET | /api/customer-statistics/level-distribution | CustomerStatisticsController接口 |
| GET | /api/customer-statistics/status-distribution | CustomerStatisticsController接口 |
| GET | /api/customer-statistics/sales-distribution | CustomerStatisticsController接口 |
| GET | /api/customer-statistics/growth-trend | CustomerStatisticsController接口 |
| GET | /api/customer-statistics/overdue-followup | CustomerStatisticsController接口 |
| GET | /api/customer-statistics/today-followup | CustomerStatisticsController接口 |
| GET | /api/customers/{id} | CustomerController接口 |
| GET | /api/customers/code/{customerCode} | CustomerController接口 |
| GET | /api/customers/{id}/branches | CustomerController接口 |
| GET | /api/customers/{id}/parent | CustomerController接口 |
| GET | /api/customers/overdue-followup | CustomerController接口 |
| GET | /api/customers/vip | CustomerController接口 |
| GET | /api/customers/health | CustomerController接口 |
| POST | /api/customers/{id}/toggle-status | CustomerController接口 |
| POST | /api/customers/{id}/level | CustomerController接口 |
| POST | /api/customers/{id}/balance | CustomerController接口 |
| PUT | /api/customers/{id} | CustomerController接口 |
| DELETE | /api/customers/{id} | CustomerController接口 |
| GET | /api/customer-relationships/customer/{customerId} | CustomerRelationshipController接口 |
| GET | /api/customer-relationships/{id} | CustomerRelationshipController接口 |
| GET | /api/customer-relationships/customer/{customerId}/branches | CustomerRelationshipController接口 |
| GET | /api/customer-relationships/headquarters/{headquartersId}/all-branches | CustomerRelationshipController接口 |
| GET | /api/customer-relationships/customer/{customerId}/parent | CustomerRelationshipController接口 |
| GET | /api/customer-relationships/customer/{customerId}/direct-parent | CustomerRelationshipController接口 |
| GET | /api/customer-relationships/headquarters | CustomerRelationshipController接口 |
| GET | /api/customer-relationships/group | CustomerRelationshipController接口 |
| GET | /api/customer-relationships/customer/{customerId}/branch-count | CustomerRelationshipController接口 |
| GET | /api/customer-relationships/customer/{customerId}/all-related | CustomerRelationshipController接口 |
| POST | /api/customer-relationships/{id}/terminate | CustomerRelationshipController接口 |
| POST | /api/customer-relationships/transfer | CustomerRelationshipController接口 |
| PUT | /api/customer-relationships/{id} | CustomerRelationshipController接口 |
| DELETE | /api/customer-relationships/{id} | CustomerRelationshipController接口 |
| GET | /api/customer-contacts/customer/{customerId} | CustomerContactController接口 |
| GET | /api/customer-contacts/customer/{customerId}/primary | CustomerContactController接口 |
| GET | /api/customer-contacts/{id} | CustomerContactController接口 |
| GET | /api/customer-contacts/mobile/{mobile} | CustomerContactController接口 |
| GET | /api/customer-contacts/email/{email} | CustomerContactController接口 |
| GET | /api/customer-contacts/customer/{customerId}/count | CustomerContactController接口 |
| GET | /api/customer-contacts/customer/{customerId}/high-influence | CustomerContactController接口 |
| POST | /api/customer-contacts/{id}/set-primary | CustomerContactController接口 |
| PUT | /api/customer-contacts/{id} | CustomerContactController接口 |
| DELETE | /api/customer-contacts/{id} | CustomerContactController接口 |
| GET | /api/customer-addresses/customer/{customerId} | CustomerAddressController接口 |
| GET | /api/customer-addresses/customer/{customerId}/default | CustomerAddressController接口 |
| GET | /api/customer-addresses/{id} | CustomerAddressController接口 |
| GET | /api/customer-addresses/customer/{customerId}/delivery | CustomerAddressController接口 |
| GET | /api/customer-addresses/customer/{customerId}/type/{addressType} | CustomerAddressController接口 |
| GET | /api/customer-addresses/customer/{customerId}/count | CustomerAddressController接口 |
| POST | /api/customer-addresses/{id}/set-default | CustomerAddressController接口 |
| PUT | /api/customer-addresses/{id} | CustomerAddressController接口 |
| DELETE | /api/customer-addresses/{id} | CustomerAddressController接口 |
| GET | /api/customer-followups/{id} | CustomerFollowUpController接口 |
| GET | /api/customer-followups/customer/{customerId} | CustomerFollowUpController接口 |
| GET | /api/customer-followups/customer/{customerId}/latest | CustomerFollowUpController接口 |
| GET | /api/customer-followups/pending | CustomerFollowUpController接口 |
| GET | /api/customer-followups/today | CustomerFollowUpController接口 |
| GET | /api/customer-followups/customer/{customerId}/count | CustomerFollowUpController接口 |
| POST | /api/customer-followups/{id}/complete | CustomerFollowUpController接口 |
| POST | /api/customer-followups/{id}/cancel | CustomerFollowUpController接口 |
| PUT | /api/customer-followups/{id} | CustomerFollowUpController接口 |
| DELETE | /api/customer-followups/{id} | CustomerFollowUpController接口 |

## 数据库表
| 表名 | 说明 |
|------|------|
| customers | Customer |
| customer_follow_ups | CustomerFollowUp |
| customer_relationships | CustomerRelationship |
| customer_contacts | CustomerContact |
| customer_addresses | CustomerAddress |

## 配置文件
- bootstrap.yml: Nacos配置
- application.yml: 应用配置

## 启动方式
```bash
mvn clean package
java -jar target/customer-service.jar
```
