|
|
@@ -1,158 +1,158 @@
|
|
|
# CLAUDE.md
|
|
|
|
|
|
-This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
|
+此文件为Claude Code (claude.ai/code)在此代码库中工作时提供指导。
|
|
|
|
|
|
-## Project Overview
|
|
|
+## 项目概述
|
|
|
|
|
|
-This is a Java-based multi-module Maven project for an insurance quotation platform, specifically focused on integrating with ZiJin Insurance Company. The project follows a microservices architecture with Spring Boot 3.0 and WebFlux for reactive programming.
|
|
|
+这是一个基于Java的多模块Maven保险报价平台项目,专门专注于与紫金保险公司集成。项目采用微服务架构,使用Spring Boot 3.0和WebFlux进行响应式编程。
|
|
|
|
|
|
-## Build and Development Commands
|
|
|
+## 构建和开发命令
|
|
|
|
|
|
-### Maven Commands
|
|
|
+### Maven命令
|
|
|
```bash
|
|
|
-# Build the entire project
|
|
|
+# 构建整个项目
|
|
|
mvn clean compile
|
|
|
|
|
|
-# Install all dependencies
|
|
|
+# 安装所有依赖
|
|
|
mvn clean install
|
|
|
|
|
|
-# Build and run specific module
|
|
|
+# 构建并运行特定模块
|
|
|
mvn spring-boot:run -pl quotation-zijin
|
|
|
|
|
|
-# Package for deployment
|
|
|
+# 打包用于部署
|
|
|
mvn clean package
|
|
|
|
|
|
-# Run specific module with Spring Boot
|
|
|
+# 使用Spring Boot运行特定模块
|
|
|
mvn spring-boot:run -pl quotation-zijin
|
|
|
```
|
|
|
|
|
|
-### Java Version
|
|
|
-- Java 17 (source and target)
|
|
|
+### Java版本
|
|
|
+- Java 17(源码和目标)
|
|
|
|
|
|
-### Key Dependencies
|
|
|
+### 关键依赖
|
|
|
- Spring Boot 3.0.0 with WebFlux
|
|
|
- Spring Data MongoDB
|
|
|
- MyBatis Plus
|
|
|
-- OpenFeign for service communication
|
|
|
-- Hutool utilities
|
|
|
-- RocketMQ for messaging
|
|
|
-- ZXing for QR code processing
|
|
|
-- WeChat integration (commons module)
|
|
|
-
|
|
|
-## Architecture
|
|
|
-
|
|
|
-### Multi-Module Structure
|
|
|
-The project is organized as a multi-module Maven project:
|
|
|
-- **Parent**: `tenant` - Common dependencies and configurations
|
|
|
-- **Business**: `insurance` - Insurance-related sub-modules
|
|
|
-- **Quotation Modules**: Each insurance company has its own module (`quotation-zijin`, `quotation-bohai`, `quotation-huatai`, etc.)
|
|
|
-- **Commons**: `quotation-commons` - Shared utilities and base classes
|
|
|
-
|
|
|
-### ZiJin Module Architecture
|
|
|
-The `quotation-zijin` module follows a layered architecture:
|
|
|
-
|
|
|
-#### API Layer (`com.jzg.quotation.zijin.api`)
|
|
|
-- **Purpose**: External API interface and business logic
|
|
|
-- **Key Components**:
|
|
|
- - `component/`: Business components (caching, request handling, error handling)
|
|
|
- - `entity/request/`: API request DTOs
|
|
|
- - `entity/response/`: API response DTOs
|
|
|
- - `entity/po/`: MongoDB entities
|
|
|
- - `service/`: Business service interfaces and implementations
|
|
|
- - `enums/`: Business enumerations
|
|
|
-
|
|
|
-#### Crawler Layer (`com.jzg.quotation.zijin.crawler`)
|
|
|
-- **Purpose**: Web scraping and external system integration
|
|
|
-- **Key Components**:
|
|
|
- - `component/`: Crawling components
|
|
|
- - `entity/request/`: Crawling request DTOs
|
|
|
- - `entity/response/`: Crawling response DTOs
|
|
|
- - `service/`: Crawling service interfaces and implementations
|
|
|
- - `enums/`: Crawling-related enumerations
|
|
|
-
|
|
|
-### Design Patterns
|
|
|
-- **Layered Architecture**: Clear separation between API and Crawler layers
|
|
|
-- **Repository Pattern**: Data access through Spring Data MongoDB
|
|
|
-- **Service Pattern**: Business logic encapsulation in service layers
|
|
|
-- **DTO Pattern**: Data transfer objects for API communication
|
|
|
-- **Strategy Pattern**: Different implementations for different insurance companies
|
|
|
-
|
|
|
-## Business Domain
|
|
|
-
|
|
|
-### Core Business Processes
|
|
|
-1. **Vehicle Quotation Process**:
|
|
|
- - Vehicle information validation and crawling
|
|
|
- - Premium calculation based on risk factors
|
|
|
- - Quote generation and presentation
|
|
|
- - Policy customization options
|
|
|
-
|
|
|
-2. **Order Management Process**:
|
|
|
- - Order creation and tracking
|
|
|
- - Premium calculation and validation
|
|
|
- - Payment link generation
|
|
|
- - Policy document generation
|
|
|
- - Status updates and notifications
|
|
|
-
|
|
|
-3. **Customer Management Process**:
|
|
|
- - Customer information validation
|
|
|
- - Policy holder and insured person management
|
|
|
- - Document upload and verification
|
|
|
- - Communication and notifications
|
|
|
-
|
|
|
-### Key Insurance Types
|
|
|
-- **Compulsory Insurance** (交通事故责任强制保险)
|
|
|
-- **Commercial Insurance** (商业险)
|
|
|
-- **Vehicle Damage Insurance** (车损险)
|
|
|
-- **Third-party Liability Insurance** (第三者责任险)
|
|
|
-- **Additional Coverage** (附加险)
|
|
|
-
|
|
|
-## Key Classes and Interfaces
|
|
|
-
|
|
|
-### Important Service Classes
|
|
|
-- `ZiJinApiRequestComponent`: Handles API request logic
|
|
|
-- `ZiJinCrawlerRequestComponent`: Manages crawling requests
|
|
|
-- `ZiJinCrawlerOrderService`: Order management and processing
|
|
|
-- `ResponseMessageAbstractHandler`: Response processing and error handling
|
|
|
-
|
|
|
-### Key Request/Response DTOs
|
|
|
-- `CalculatePremiumRequest`: Premium calculation request
|
|
|
-- `GetAccessTokenRequest`: Authentication token request
|
|
|
-- `ModelQueryRequest`: Vehicle model query request
|
|
|
-- `ZiJinApiOrder`: Order entity for MongoDB
|
|
|
-
|
|
|
-### Configuration and Enums
|
|
|
-- `RequestUrl`: Enum for API endpoints
|
|
|
-- `RiskCodeEnum`: Risk type enumeration
|
|
|
-- `OrderStatusEnum`: Order status tracking
|
|
|
-- `MotorVehicleInsuranceEnum`: Insurance type enumeration
|
|
|
-
|
|
|
-## Development Guidelines
|
|
|
-
|
|
|
-### Working with Insurance Company Integrations
|
|
|
-Each insurance company module follows the same pattern but with different implementations:
|
|
|
-1. API layer for external interface
|
|
|
-2. Crawler layer for external system integration
|
|
|
-3. Separate request/response DTOs
|
|
|
-4. Company-specific business logic
|
|
|
-
|
|
|
-### Database Operations
|
|
|
-- Uses MongoDB as primary database
|
|
|
-- Spring Data MongoDB for repository operations
|
|
|
-- PO classes in `entity/po/` package
|
|
|
-
|
|
|
-### External Integration Points
|
|
|
-- Insurance company APIs (ZiJin systems)
|
|
|
-- Vehicle information crawling services
|
|
|
-- Payment gateway integration
|
|
|
-- WeChat integration for notifications
|
|
|
-
|
|
|
-### Error Handling
|
|
|
-- Custom exception components for different error scenarios
|
|
|
-- Structured response handling with ResultEnum
|
|
|
-- Comprehensive logging for debugging
|
|
|
-
|
|
|
-## Testing
|
|
|
-No specific test configuration found in the current structure. Standard Maven test commands apply:
|
|
|
+- OpenFeign用于服务通信
|
|
|
+- Hutool工具库
|
|
|
+- RocketMQ消息队列
|
|
|
+- ZXing二维码处理
|
|
|
+- 微信集成(commons模块)
|
|
|
+
|
|
|
+## 架构
|
|
|
+
|
|
|
+### 多模块结构
|
|
|
+项目组织为多模块Maven项目:
|
|
|
+- **父模块**: `tenant` - 公共依赖和配置
|
|
|
+- **业务模块**: `insurance` - 保险相关子模块
|
|
|
+- **报价模块**: 每个保险公司都有自己的模块(`quotation-zijin`、`quotation-bohai`、`quotation-huatai`等)
|
|
|
+- **公共模块**: `quotation-commons` - 共享工具和基础类
|
|
|
+
|
|
|
+### 紫金模块架构
|
|
|
+`quotation-zijin`模块遵循分层架构:
|
|
|
+
|
|
|
+#### API层(`com.jzg.quotation.zijin.api`)
|
|
|
+- **用途**: 外部API接口和业务逻辑
|
|
|
+- **核心组件**:
|
|
|
+ - `component/`: 业务组件(缓存、请求处理、错误处理)
|
|
|
+ - `entity/request/`: API请求DTO
|
|
|
+ - `entity/response/`: API响应DTO
|
|
|
+ - `entity/po/`: MongoDB实体
|
|
|
+ - `service/`: 业务服务接口和实现
|
|
|
+ - `enums/`: 业务枚举
|
|
|
+
|
|
|
+#### 爬虫层(`com.jzg.quotation.zijin.crawler`)
|
|
|
+- **用途**: 网页爬取和外部系统集成
|
|
|
+- **核心组件**:
|
|
|
+ - `component/`: 爬取组件
|
|
|
+ - `entity/request/`: 爬取请求DTO
|
|
|
+ - `entity/response/`: 爬取响应DTO
|
|
|
+ - `service/`: 爬取服务接口和实现
|
|
|
+ - `enums/`: 爬取相关枚举
|
|
|
+
|
|
|
+### 设计模式
|
|
|
+- **分层架构**: API层和爬虫层清晰分离
|
|
|
+- **仓储模式**: 通过Spring Data MongoDB进行数据访问
|
|
|
+- **服务模式**: 业务逻辑封装在服务层中
|
|
|
+- **DTO模式**: 用于API通信的数据传输对象
|
|
|
+- **策略模式**: 不同保险公司的不同实现
|
|
|
+
|
|
|
+## 业务领域
|
|
|
+
|
|
|
+### 核心业务流程
|
|
|
+1. **车辆报价流程**:
|
|
|
+ - 车辆信息验证和爬取
|
|
|
+ - 基于风险因素的保费计算
|
|
|
+ - 报价生成和展示
|
|
|
+ - 保单定制选项
|
|
|
+
|
|
|
+2. **订单管理流程**:
|
|
|
+ - 订单创建和跟踪
|
|
|
+ - 保费计算和验证
|
|
|
+ - 支付链接生成
|
|
|
+ - 保单文档生成
|
|
|
+ - 状态更新和通知
|
|
|
+
|
|
|
+3. **客户管理流程**:
|
|
|
+ - 客户信息验证
|
|
|
+ - 投保人和被保险人管理
|
|
|
+ - 文档上传和验证
|
|
|
+ - 沟通和通知
|
|
|
+
|
|
|
+### 主要保险类型
|
|
|
+- **交强险** (交通事故责任强制保险)
|
|
|
+- **商业险** (商业保险)
|
|
|
+- **车损险** (车辆损失险)
|
|
|
+- **第三者责任险** (第三者责任保险)
|
|
|
+- **附加险** (附加保险)
|
|
|
+
|
|
|
+## 核心类和接口
|
|
|
+
|
|
|
+### 重要服务类
|
|
|
+- `ZiJinApiRequestComponent`: 处理API请求逻辑
|
|
|
+- `ZiJinCrawlerRequestComponent`: 管理爬取请求
|
|
|
+- `ZiJinCrawlerOrderService`: 订单管理和处理
|
|
|
+- `ResponseMessageAbstractHandler`: 响应处理和错误处理
|
|
|
+
|
|
|
+### 关键请求/响应DTO
|
|
|
+- `CalculatePremiumRequest`: 保费计算请求
|
|
|
+- `GetAccessTokenRequest`: 认证令牌请求
|
|
|
+- `ModelQueryRequest`: 车型查询请求
|
|
|
+- `ZiJinApiOrder`: MongoDB的订单实体
|
|
|
+
|
|
|
+### 配置和枚举
|
|
|
+- `RequestUrl`: API端点枚举
|
|
|
+- `RiskCodeEnum`: 风险类型枚举
|
|
|
+- `OrderStatusEnum`: 订单状态跟踪
|
|
|
+- `MotorVehicleInsuranceEnum`: 保险类型枚举
|
|
|
+
|
|
|
+## 开发指南
|
|
|
+
|
|
|
+### 保险公司集成工作
|
|
|
+每个保险公司模块遵循相同模式但实现不同:
|
|
|
+1. 外部接口的API层
|
|
|
+2. 外部系统集成的爬虫层
|
|
|
+3. 分离的请求/响应DTO
|
|
|
+4. 公司特定的业务逻辑
|
|
|
+
|
|
|
+### 数据库操作
|
|
|
+- 使用MongoDB作为主数据库
|
|
|
+- Spring Data MongoDB用于仓储操作
|
|
|
+- PO类位于`entity/po/`包中
|
|
|
+
|
|
|
+### 外部集成点
|
|
|
+- 保险公司API(紫金系统)
|
|
|
+- 车辆信息爬取服务
|
|
|
+- 支付网关集成
|
|
|
+- 微信通知集成
|
|
|
+
|
|
|
+### 错误处理
|
|
|
+- 针对不同错误场景的自定义异常组件
|
|
|
+- 使用ResultEnum的结构化响应处理
|
|
|
+- 用于调试的全面日志记录
|
|
|
+
|
|
|
+## 测试
|
|
|
+当前结构中未找到特定的测试配置。应用标准Maven测试命令:
|
|
|
```bash
|
|
|
mvn test
|
|
|
mvn surefire:test
|