diff --git a/src/main/java/com/rj/common/PasswordUtil.java b/src/main/java/com/rj/common/PasswordUtil.java index 2e92510..ceac288 100644 --- a/src/main/java/com/rj/common/PasswordUtil.java +++ b/src/main/java/com/rj/common/PasswordUtil.java @@ -106,6 +106,9 @@ public class PasswordUtil { + + + diff --git a/src/main/java/com/rj/common/ServiceManager.java b/src/main/java/com/rj/common/ServiceManager.java index 8d90d8d..b89e968 100644 --- a/src/main/java/com/rj/common/ServiceManager.java +++ b/src/main/java/com/rj/common/ServiceManager.java @@ -90,6 +90,9 @@ public class ServiceManager { + + + diff --git a/src/main/java/com/rj/config/AliyunConfig.java b/src/main/java/com/rj/config/AliyunConfig.java index 8ba097d..87e2faf 100644 --- a/src/main/java/com/rj/config/AliyunConfig.java +++ b/src/main/java/com/rj/config/AliyunConfig.java @@ -69,6 +69,9 @@ public class AliyunConfig { + + + diff --git a/src/main/java/com/rj/controller/sys/AuthController.java b/src/main/java/com/rj/controller/sys/AuthController.java index 69541d9..9862abc 100644 --- a/src/main/java/com/rj/controller/sys/AuthController.java +++ b/src/main/java/com/rj/controller/sys/AuthController.java @@ -189,6 +189,9 @@ public class AuthController { + + + diff --git a/src/main/java/com/rj/controller/sys/MenuController.java b/src/main/java/com/rj/controller/sys/MenuController.java index a6a87ca..e06e297 100644 --- a/src/main/java/com/rj/controller/sys/MenuController.java +++ b/src/main/java/com/rj/controller/sys/MenuController.java @@ -328,6 +328,9 @@ public class MenuController { + + + diff --git a/src/main/java/com/rj/controller/sys/RoleController.java b/src/main/java/com/rj/controller/sys/RoleController.java index cfd788a..f8e9816 100644 --- a/src/main/java/com/rj/controller/sys/RoleController.java +++ b/src/main/java/com/rj/controller/sys/RoleController.java @@ -298,6 +298,9 @@ public class RoleController { + + + diff --git a/src/main/java/com/rj/controller/sys/UserRoleController.java b/src/main/java/com/rj/controller/sys/UserRoleController.java index fea86ba..9e82b04 100644 --- a/src/main/java/com/rj/controller/sys/UserRoleController.java +++ b/src/main/java/com/rj/controller/sys/UserRoleController.java @@ -304,6 +304,9 @@ public class UserRoleController { + + + diff --git a/src/main/java/com/rj/dto/DifyWorkflowResponseDto.java b/src/main/java/com/rj/dto/DifyWorkflowResponseDto.java index 9a2e4be..1252696 100644 --- a/src/main/java/com/rj/dto/DifyWorkflowResponseDto.java +++ b/src/main/java/com/rj/dto/DifyWorkflowResponseDto.java @@ -74,3 +74,6 @@ public class DifyWorkflowResponseDto { + + + diff --git a/src/main/java/com/rj/entity/CustomerProfileAnalysis.java b/src/main/java/com/rj/entity/CustomerProfileAnalysis.java index a46946e..1aae990 100644 --- a/src/main/java/com/rj/entity/CustomerProfileAnalysis.java +++ b/src/main/java/com/rj/entity/CustomerProfileAnalysis.java @@ -51,6 +51,42 @@ public class CustomerProfileAnalysis { @TableField("dealer_code") private String dealerCode; + /** + * 经销商门店名称 + */ + @TableField("dealer_name") + private String dealerName; + + /** + * 大区 + */ + @TableField("big_area") + private String bigArea; + + /** + * 项目ID + */ + @TableField("project_id") + private String projectId; + + /** + * 项目名称 + */ + @TableField("project_name") + private String projectName; + + /** + * 销售顾问ID + */ + @TableField("sales_person_id") + private String salesPersonId; + + /** + * 销售顾问姓名 + */ + @TableField("sales_person_name") + private String salesPersonName; + /** * 商机ID */ diff --git a/src/main/java/com/rj/mapper/CustomerProfileAnalysisMapper.java b/src/main/java/com/rj/mapper/CustomerProfileAnalysisMapper.java index 9d787b3..105538e 100644 --- a/src/main/java/com/rj/mapper/CustomerProfileAnalysisMapper.java +++ b/src/main/java/com/rj/mapper/CustomerProfileAnalysisMapper.java @@ -18,3 +18,6 @@ public interface CustomerProfileAnalysisMapper extends BaseMapper { + + + diff --git a/src/main/java/com/rj/service/sys/IUserRoleService.java b/src/main/java/com/rj/service/sys/IUserRoleService.java index 9effbab..bc2111a 100644 --- a/src/main/java/com/rj/service/sys/IUserRoleService.java +++ b/src/main/java/com/rj/service/sys/IUserRoleService.java @@ -37,6 +37,9 @@ public interface IUserRoleService extends IService { + + + diff --git a/src/main/java/com/rj/service/sys/impl/MenuServiceImpl.java b/src/main/java/com/rj/service/sys/impl/MenuServiceImpl.java index e1438e1..3826eca 100644 --- a/src/main/java/com/rj/service/sys/impl/MenuServiceImpl.java +++ b/src/main/java/com/rj/service/sys/impl/MenuServiceImpl.java @@ -41,6 +41,9 @@ public class MenuServiceImpl extends ServiceImpl implements IM + + + diff --git a/src/main/java/com/rj/service/sys/impl/RoleServiceImpl.java b/src/main/java/com/rj/service/sys/impl/RoleServiceImpl.java index 509b3be..1f7cfe4 100644 --- a/src/main/java/com/rj/service/sys/impl/RoleServiceImpl.java +++ b/src/main/java/com/rj/service/sys/impl/RoleServiceImpl.java @@ -41,6 +41,9 @@ public class RoleServiceImpl extends ServiceImpl implements IR + + + diff --git a/src/main/java/com/rj/service/sys/impl/UserRoleServiceImpl.java b/src/main/java/com/rj/service/sys/impl/UserRoleServiceImpl.java index 2ba1149..4f7b92a 100644 --- a/src/main/java/com/rj/service/sys/impl/UserRoleServiceImpl.java +++ b/src/main/java/com/rj/service/sys/impl/UserRoleServiceImpl.java @@ -41,6 +41,9 @@ public class UserRoleServiceImpl extends ServiceImpl i + + + diff --git a/src/main/resources/application-audio.yml b/src/main/resources/application-audio.yml index 85796e4..47a93f8 100644 --- a/src/main/resources/application-audio.yml +++ b/src/main/resources/application-audio.yml @@ -51,6 +51,9 @@ spring: + + + diff --git a/src/main/resources/customer-profile-analysis-example.json b/src/main/resources/customer-profile-analysis-example.json index 6442b17..e979b3f 100644 --- a/src/main/resources/customer-profile-analysis-example.json +++ b/src/main/resources/customer-profile-analysis-example.json @@ -11,3 +11,6 @@ + + + diff --git a/src/main/resources/mapper/AudioManagementStatisticsMapper.xml b/src/main/resources/mapper/AudioManagementStatisticsMapper.xml index de0d8ed..6943533 100644 --- a/src/main/resources/mapper/AudioManagementStatisticsMapper.xml +++ b/src/main/resources/mapper/AudioManagementStatisticsMapper.xml @@ -27,6 +27,9 @@ + + + diff --git a/src/main/sql/customer_profile_analysis.sql b/src/main/sql/customer_profile_analysis.sql index 043deed..547c8ce 100644 --- a/src/main/sql/customer_profile_analysis.sql +++ b/src/main/sql/customer_profile_analysis.sql @@ -1,3 +1,7 @@ + +-- customer_profile_analysis.sql + + CREATE TABLE `customer_business`.`customer_profile_analysis` ( `id` VARCHAR(36) NOT NULL COMMENT '主键UUID', `profile_analysis_record_id` VARCHAR(255) NOT NULL COMMENT 'AI分析记录ID', @@ -5,6 +9,11 @@ CREATE TABLE `customer_business`.`customer_profile_analysis` ( `interaction_date` DATETIME NOT NULL COMMENT '沟通时间:AI通话录音-通话开始时间 企微会话-语料消息截至时间 面谈-语料消息截至时间', `related_business_id` VARCHAR(255) NOT NULL COMMENT '业务ID:根据分析不同传不同的值 1-unionId 2-通话ID 3-客流ID 4-试驾ID', `dealer_code` VARCHAR(36) DEFAULT NULL COMMENT '经销商编码', + `dealer_name` VARCHAR(100) DEFAULT NULL COMMENT '经销商门店名称', + `project_id` VARCHAR(36) DEFAULT NULL COMMENT '项目ID', + `project_name` VARCHAR(100) DEFAULT NULL COMMENT '项目名称', + `sales_person_id` VARCHAR(36) DEFAULT NULL COMMENT '销售顾问ID', + `sales_person_name` VARCHAR(50) DEFAULT NULL COMMENT '销售顾问姓名', `opportunity_id` VARCHAR(36) DEFAULT NULL COMMENT '商机ID', `client_id` VARCHAR(36) DEFAULT NULL COMMENT '客户ID', `client_name` VARCHAR(100) DEFAULT NULL COMMENT '客户姓名', diff --git a/src/main/sql/customer_profile_analysis_table_fields_classification.md b/src/main/sql/customer_profile_analysis_table_fields_classification.md new file mode 100644 index 0000000..77fd685 --- /dev/null +++ b/src/main/sql/customer_profile_analysis_table_fields_classification.md @@ -0,0 +1,192 @@ +# Customer Profile Analysis 表字段分类 + +## 1. 主键和基础标识字段 (Primary Key & Basic Identity Fields) +| 字段名 | 类型 | 是否必填 | 说明 | +|--------|------|----------|------| +| `id` | VARCHAR(36) | NOT NULL | 主键UUID | +| `profile_analysis_record_id` | VARCHAR(255) | NOT NULL | AI分析记录ID | +| `analysis_scene_type` | TINYINT UNSIGNED | NOT NULL | 分析类型:1-企微会话 2-AI通话录音 3-AI铭牌(客流) 4-AI铭牌(试驾) | +| `related_business_id` | VARCHAR(255) | NOT NULL | 业务ID:根据分析不同传不同的值 1-unionId 2-通话ID 3-客流ID 4-试驾ID | + +## 2. 时间相关字段 (Time Related Fields) +| 字段名 | 类型 | 是否必填 | 说明 | +|--------|------|----------|------| +| `interaction_date` | DATETIME | NOT NULL | 沟通时间:AI通话录音-通话开始时间 企微会话-语料消息截至时间 面谈-语料消息截至时间 | +| `created_at` | DATETIME | NOT NULL | 创建时间 | +| `updated_at` | DATETIME | NOT NULL | 更新时间 | + +## 3. 经销商和组织信息字段 (Dealer & Organization Fields) +| 字段名 | 类型 | 是否必填 | 说明 | +|--------|------|----------|------| +| `dealer_code` | VARCHAR(36) | NULL | 经销商编码 | +| `dealer_name` | VARCHAR(100) | NULL | 经销商门店名称 | +| `big_area` | VARCHAR(50) | NULL | 大区 | +| `project_id` | VARCHAR(36) | NULL | 项目ID | +| `project_name` | VARCHAR(100) | NULL | 项目名称 | + +## 4. 销售团队信息字段 (Sales Team Fields) +| 字段名 | 类型 | 是否必填 | 说明 | +|--------|------|----------|------| +| `sales_person_id` | VARCHAR(36) | NULL | 销售顾问ID | +| `sales_person_name` | VARCHAR(50) | NULL | 销售顾问姓名 | + +## 5. 商机和客户信息字段 (Opportunity & Customer Fields) +| 字段名 | 类型 | 是否必填 | 说明 | +|--------|------|----------|------| +| `opportunity_id` | VARCHAR(36) | NULL | 商机ID | +| `client_id` | VARCHAR(36) | NULL | 客户ID | +| `client_name` | VARCHAR(100) | NULL | 客户姓名 | +| `client_phone` | VARCHAR(20) | NULL | 客户电话 | + +## 6. 购车意向信息字段 (Purchase Intention Fields) +| 字段名 | 类型 | 是否必填 | 说明 | +|--------|------|----------|------| +| `purchase_date` | VARCHAR(50) | NULL | 预购日期(示例值:天数) | +| `purchase_type` | VARCHAR(20) | NULL | 购买类型(示例值:新购/置换/增购) | +| `payment_way` | VARCHAR(20) | NULL | 付款方式(示例值:贷款/全款/分期) | +| `competitor_brand` | VARCHAR(50) | NULL | 竞品品牌(示例值:奔驰/宝马/奥迪) | +| `vehicle_usage` | VARCHAR(20) | NULL | 购车用途(示例值:家用/商用/代步) | +| `primary_driver` | VARCHAR(20) | NULL | 实际驾驶人(示例值:本人/家人/其他) | +| `budget_range` | VARCHAR(50) | NULL | 购车预算(示例值:具体预算范围) | +| `purchase_qualification` | VARCHAR(10) | NULL | 购车资质(示例值:是否) | + +## 7. 客户个人背景信息字段 (Customer Background Fields) +| 字段名 | 类型 | 是否必填 | 说明 | +|--------|------|----------|------| +| `education_level` | VARCHAR(20) | NULL | 教育水平(示例值:本科/硕士/高中) | +| `family_composition` | VARCHAR(50) | NULL | 家庭结构(示例值:已婚有子女/单身) | +| `monthly_income` | VARCHAR(50) | NULL | 家庭月收入(示例值:具体收入区间) | +| `job_title` | VARCHAR(50) | NULL | 职业(示例值:教师/工程师/医生) | +| `company_type` | VARCHAR(50) | NULL | 企业性质(示例值:民营企业/国企/外企) | +| `industry_sector` | VARCHAR(50) | NULL | 所属行业(示例值:教育/互联网/金融) | +| `home_address` | VARCHAR(200) | NULL | 详细地址(非枚举,示例值) | +| `family_size` | VARCHAR(10) | NULL | 家庭人数(非枚举,示例值) | +| `hobby` | VARCHAR(200) | NULL | 个人爱好(非枚举,示例值) | + +## 8. 客户关注点和偏好字段 (Customer Focus & Preference Fields) +| 字段名 | 类型 | 是否必填 | 说明 | +|--------|------|----------|------| +| `interest_focus` | VARCHAR(200) | NULL | 兴趣点(示例值:智能驾驶/油耗/空间) | +| `concern_point` | VARCHAR(200) | NULL | 顾虑点(示例值:保养成本/保值率) | +| `current_brand` | VARCHAR(50) | NULL | 保有品牌(非枚举,示例值) | + +## 9. 备注和扩展信息字段 (Notes & Extended Information Fields) +| 字段名 | 类型 | 是否必填 | 说明 | +|--------|------|----------|------| +| `notes` | VARCHAR(500) | NULL | 备注(非枚举,保留名称) | + +## 10. 实体情感分析字段 (Entity Sentiment Analysis Fields) + +### 10.1 品牌和设计相关情感 +| 字段名 | 类型 | 是否必填 | 说明 | +|--------|------|----------|------| +| `entity_brand` | VARCHAR(10) | NULL | 品牌情感倾向:积极/中性/消极 | +| `entity_brand_reason` | VARCHAR(500) | NULL | 品牌情感倾向原因 | +| `entity_design` | VARCHAR(10) | NULL | 外观设计情感倾向:积极/中性/消极 | +| `entity_design_reason` | VARCHAR(500) | NULL | 外观设计情感倾向原因 | +| `entity_color` | VARCHAR(10) | NULL | 颜色情感倾向:积极/中性/消极 | +| `entity_color_reason` | VARCHAR(500) | NULL | 颜色情感倾向原因 | + +### 10.2 车辆尺寸和空间相关情感 +| 字段名 | 类型 | 是否必填 | 说明 | +|--------|------|----------|------| +| `entity_size` | VARCHAR(10) | NULL | 尺寸情感倾向:积极/中性/消极 | +| `entity_size_reason` | VARCHAR(500) | NULL | 尺寸情感倾向原因 | +| `entity_space` | VARCHAR(10) | NULL | 空间情感倾向:积极/中性/消极 | +| `entity_space_reason` | VARCHAR(500) | NULL | 空间情感倾向原因 | + +### 10.3 内饰和配置相关情感 +| 字段名 | 类型 | 是否必填 | 说明 | +|--------|------|----------|------| +| `entity_interior` | VARCHAR(10) | NULL | 内饰情感倾向:积极/中性/消极 | +| `entity_interior_reason` | VARCHAR(500) | NULL | 内饰情感倾向原因 | +| `entity_audio` | VARCHAR(10) | NULL | 音响情感倾向:积极/中性/消极 | +| `entity_audio_reason` | VARCHAR(500) | NULL | 音响情感倾向原因 | +| `entity_ivinfo` | VARCHAR(10) | NULL | 车机情感倾向:积极/中性/消极 | +| `entity_ivinfo_reason` | VARCHAR(500) | NULL | 车机情感倾向原因 | + +### 10.4 智能驾驶和续航相关情感 +| 字段名 | 类型 | 是否必填 | 说明 | +|--------|------|----------|------| +| `entity_fsd` | VARCHAR(10) | NULL | 智驾情感倾向:积极/中性/消极 | +| `entity_fsd_reason` | VARCHAR(500) | NULL | 智驾情感倾向原因 | +| `entity_mileage` | VARCHAR(10) | NULL | 续航情感倾向:积极/中性/消极 | +| `entity_mileage_reason` | VARCHAR(500) | NULL | 续航情感倾向原因 | + +### 10.5 安全和环保相关情感 +| 字段名 | 类型 | 是否必填 | 说明 | +|--------|------|----------|------| +| `entity_safety` | VARCHAR(10) | NULL | 安全情感倾向:积极/中性/消极 | +| `entity_safety_reason` | VARCHAR(500) | NULL | 安全情感倾向原因 | +| `entity_eco` | VARCHAR(10) | NULL | 环保情感倾向:积极/中性/消极 | +| `entity_eco_reason` | VARCHAR(500) | NULL | 环保情感倾向原因 | +| `entity_liscense` | VARCHAR(10) | NULL | 绿牌/路权情感倾向:积极/中性/消极 | +| `entity_liscense_reason` | VARCHAR(500) | NULL | 绿牌/路权情感倾向原因 | + +### 10.6 价格和成本相关情感 +| 字段名 | 类型 | 是否必填 | 说明 | +|--------|------|----------|------| +| `entity_price` | VARCHAR(10) | NULL | 价格情感倾向:积极/中性/消极 | +| `entity_price_reason` | VARCHAR(500) | NULL | 价格情感倾向原因 | +| `entity_benefit` | VARCHAR(10) | NULL | 购车权益情感倾向:积极/中性/消极 | +| `entity_benefit_reason` | VARCHAR(500) | NULL | 购车权益情感倾向原因 | +| `entity_cost` | VARCHAR(10) | NULL | 用车成本情感倾向:积极/中性/消极 | +| `entity_cost_reason` | VARCHAR(500) | NULL | 用车成本情感倾向原因 | +| `entity_value` | VARCHAR(10) | NULL | 性价比情感倾向:积极/中性/消极 | +| `entity_value_reason` | VARCHAR(500) | NULL | 性价比情感倾向原因 | + +### 10.7 动力和操控相关情感 +| 字段名 | 类型 | 是否必填 | 说明 | +|--------|------|----------|------| +| `entity_power` | VARCHAR(10) | NULL | 动力情感倾向:积极/中性/消极 | +| `entity_power_reason` | VARCHAR(500) | NULL | 动力情感倾向原因 | +| `entity_control` | VARCHAR(10) | NULL | 操控情感倾向:积极/中性/消极 | +| `entity_control_reason` | VARCHAR(500) | NULL | 操控情感倾向原因 | + +### 10.8 服务和政策相关情感 +| 字段名 | 类型 | 是否必填 | 说明 | +|--------|------|----------|------| +| `entity_tradein` | VARCHAR(10) | NULL | 置换政策情感倾向:积极/中性/消极 | +| `entity_tradein_reason` | VARCHAR(500) | NULL | 置换政策情感倾向原因 | +| `entity_finance` | VARCHAR(10) | NULL | 金融方案情感倾向:积极/中性/消极 | +| `entity_finance_reason` | VARCHAR(500) | NULL | 金融方案情感倾向原因 | +| `entity_warranty` | VARCHAR(10) | NULL | 质保情感倾向:积极/中性/消极 | +| `entity_warranty_reason` | VARCHAR(500) | NULL | 质保情感倾向原因 | +| `entity_delivery` | VARCHAR(10) | NULL | 交付时间情感倾向:积极/中性/消极 | +| `entity_delivery_reason` | VARCHAR(500) | NULL | 交付时间情感倾向原因 | + +## 11. 系统管理字段 (System Management Fields) +| 字段名 | 类型 | 是否必填 | 说明 | +|--------|------|----------|------| +| `created_by` | VARCHAR(36) | NULL | 创建人id | +| `updated_by` | VARCHAR(36) | NULL | 更新人id | +| `create_sqlby` | VARCHAR(8) | NULL | 创建sql人 | +| `update_sqlby` | VARCHAR(8) | NULL | 更新人sql人 | +| `record_version` | TINYINT UNSIGNED | DEFAULT 0 | 版本号(乐观锁) | +| `is_deleted` | TINYINT UNSIGNED | NOT NULL DEFAULT 0 | 是否删除 | + +## 字段分类总结 + +### 按功能分类: +1. **基础标识字段** (4个):主键、分析记录ID、分析类型、业务ID +2. **时间字段** (3个):交互时间、创建时间、更新时间 +3. **组织架构字段** (5个):经销商、大区、项目信息 +4. **人员信息字段** (2个):销售顾问信息 +5. **客户信息字段** (4个):商机、客户基本信息 +6. **购车意向字段** (8个):购车相关的意向和偏好 +7. **客户背景字段** (8个):个人背景和社会属性 +8. **关注偏好字段** (3个):兴趣点和顾虑点 +9. **备注字段** (1个):扩展备注信息 +10. **情感分析字段** (46个):各种实体的情感倾向和原因 +11. **系统管理字段** (6个):审计和版本控制 + +### 按数据来源分类: +- **系统生成字段**:id、created_at、updated_at、record_version、is_deleted +- **业务输入字段**:大部分业务相关字段 +- **AI分析字段**:所有entity_*字段 +- **用户输入字段**:客户基本信息、购车意向等 + +### 按更新频率分类: +- **静态字段**:客户背景信息、组织架构信息 +- **动态字段**:情感分析结果、购车意向 +- **系统字段**:时间戳、版本号等 diff --git a/src/main/sql/适配准真实.sql b/src/main/sql/适配准真实.sql index fac14e3..0ef0f27 100644 --- a/src/main/sql/适配准真实.sql +++ b/src/main/sql/适配准真实.sql @@ -1,4 +1,6 @@ -适配项目的JSON: +filename: 适配准真实.sql + +适配项目的JSON--开始 { "project_management": [ { @@ -27,8 +29,13 @@ } ] } +适配项目的JSON--结束 -适配销售顾问的JSON: + + + + +适配销售顾问的JSON--开始 { "sales_management": [ { @@ -65,12 +72,15 @@ } ] } +适配销售顾问的JSON--结束 - -适配经销商门店的JSON* +适配经销商门店的JSON ---开始 {'1957424710587330562', '广州奔驰4S店'},{'1957424711560409089', '北京奥迪4S店'},{'1957424714953601026', '上海宝马4S店'},{'1957424739267981313', '深圳雷克萨斯4S店'},{'1957424740000000001', '成都保时捷4S店'},{'1957424740000000017', '昆明威兹曼4S店'},{} +适配经销商门店的JSON --结束 -适配单向开口率的JSON: + + +适配单向开口率的JSON--开始 { { "id": "1957424800000000001","name":"沃尔沃M90续航亮点" @@ -85,7 +95,7 @@ "id": "1957424800000000004","name":"lexusRX470刹车问题" } } - +适配单向开口率的JSON--结束 diff --git a/src/test/java/com/rj/service/DifyWorkflowServiceTest.java b/src/test/java/com/rj/service/DifyWorkflowServiceTest.java index f921f09..abe71d1 100644 --- a/src/test/java/com/rj/service/DifyWorkflowServiceTest.java +++ b/src/test/java/com/rj/service/DifyWorkflowServiceTest.java @@ -1,13 +1,16 @@ package com.rj.service; +import com.rj.entity.CustomerProfileAnalysis; import com.rj.service.DifyWorkflowService.DifyWorkflowRequest; import com.rj.service.DifyWorkflowService.DifyWorkflowResponse; +import com.rj.service.biz.impl.CustomerProfileAnalysisServiceImpl; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import java.util.HashMap; +import java.util.List; import java.util.Map; import static org.junit.jupiter.api.Assertions.*; @@ -25,11 +28,116 @@ public class DifyWorkflowServiceTest { @Autowired private DifyWorkflowService difyWorkflowService; + @Autowired + CustomerProfileAnalysisServiceImpl customerProfileAnalysisService;; + + @Test + public void testSaveCustomerProfileAnalysis() { + CustomerProfileAnalysis customerProfileAnalysis = new CustomerProfileAnalysis(); + + // 基本信息字段 + customerProfileAnalysis.setId("test_union_12365"); + customerProfileAnalysis.setProfileAnalysisRecordId("profile_record_001"); + customerProfileAnalysis.setAnalysisSceneType(1); // 1-企微会话 + customerProfileAnalysis.setInteractionDate(java.time.LocalDateTime.now()); + customerProfileAnalysis.setRelatedBusinessId("business_12345"); + + // 经销商信息 + customerProfileAnalysis.setDealerCode("DEALER001"); + customerProfileAnalysis.setDealerName("测试经销商门店"); + customerProfileAnalysis.setBigArea("华北区"); + + // 项目信息 + customerProfileAnalysis.setProjectId("PROJECT001"); + customerProfileAnalysis.setProjectName("测试项目"); + + // 销售顾问信息 + customerProfileAnalysis.setSalesPersonId("sales_001"); + customerProfileAnalysis.setSalesPersonName("张三"); + + // 商机和客户信息 + customerProfileAnalysis.setOpportunityId("OPP001"); + customerProfileAnalysis.setClientId("CLIENT001"); + customerProfileAnalysis.setClientName("李四"); + customerProfileAnalysis.setClientPhone("13800138000"); + + // 客户画像信息 + customerProfileAnalysis.setPurchaseDate("30天内"); + customerProfileAnalysis.setPurchaseType("新购"); + customerProfileAnalysis.setPaymentWay("贷款"); + customerProfileAnalysis.setCompetitorBrand("奔驰"); + customerProfileAnalysis.setVehicleUsage("家用"); + customerProfileAnalysis.setPrimaryDriver("本人"); + customerProfileAnalysis.setBudgetRange("30-40万"); + customerProfileAnalysis.setEducationLevel("本科"); + customerProfileAnalysis.setFamilyComposition("已婚有子女"); + customerProfileAnalysis.setMonthlyIncome("15000-25000"); + customerProfileAnalysis.setJobTitle("工程师"); + customerProfileAnalysis.setCompanyType("民营企业"); + customerProfileAnalysis.setIndustrySector("互联网"); + customerProfileAnalysis.setInterestFocus("智能驾驶"); + customerProfileAnalysis.setConcernPoint("保养成本"); + customerProfileAnalysis.setPurchaseQualification("是"); + customerProfileAnalysis.setNotes("客户对安全性能比较关注"); + customerProfileAnalysis.setCurrentBrand("大众"); + customerProfileAnalysis.setHomeAddress("北京市朝阳区"); + customerProfileAnalysis.setFamilySize("4人"); + customerProfileAnalysis.setHobby("旅游、运动"); + + // 实体情感分析字段 + customerProfileAnalysis.setEntityBrand("积极"); + customerProfileAnalysis.setEntityBrandReason("客户对品牌认知度较高"); + customerProfileAnalysis.setEntityDesign("积极"); + customerProfileAnalysis.setEntityDesignReason("喜欢外观设计"); + customerProfileAnalysis.setEntityColor("中性"); + customerProfileAnalysis.setEntityColorReason("对颜色没有特别偏好"); + customerProfileAnalysis.setEntityPrice("积极"); + customerProfileAnalysis.setEntityPriceReason("认为价格合理"); + customerProfileAnalysis.setEntitySpace("积极"); + customerProfileAnalysis.setEntitySpaceReason("空间满足需求"); + customerProfileAnalysis.setEntityInterior("积极"); + customerProfileAnalysis.setEntityInteriorReason("内饰舒适性良好"); + customerProfileAnalysis.setEntitySafety("积极"); + customerProfileAnalysis.setEntitySafetyReason("安全性能突出"); + customerProfileAnalysis.setEntityPower("中性"); + customerProfileAnalysis.setEntityPowerReason("动力够用"); + customerProfileAnalysis.setEntityControl("积极"); + customerProfileAnalysis.setEntityControlReason("操控性好"); + customerProfileAnalysis.setEntityTradein("积极"); + customerProfileAnalysis.setEntityTradeinReason("置换政策优惠"); + customerProfileAnalysis.setEntityFinance("积极"); + customerProfileAnalysis.setEntityFinanceReason("金融方案灵活"); + customerProfileAnalysis.setEntityWarranty("积极"); + customerProfileAnalysis.setEntityWarrantyReason("质保政策完善"); + customerProfileAnalysis.setEntityDelivery("积极"); + customerProfileAnalysis.setEntityDeliveryReason("交付时间合理"); + + // 系统字段 + customerProfileAnalysis.setCreatedBy("test_user"); + customerProfileAnalysis.setCreatedAt(java.time.LocalDateTime.now()); + customerProfileAnalysis.setUpdatedBy("test_user"); + customerProfileAnalysis.setUpdatedAt(java.time.LocalDateTime.now()); + customerProfileAnalysis.setCreateSqlby("test_sql_user"); + customerProfileAnalysis.setUpdateSqlby("test_sql_user"); + + // 保存到数据库 + customerProfileAnalysisService.save(customerProfileAnalysis); + + System.out.println("客户画像分析数据保存成功!ID: " + customerProfileAnalysis.getId()); + + List savedRecords = customerProfileAnalysisService.list(); + assertFalse(savedRecords.isEmpty(), "数据库中应该有保存的记录"); + + System.out.println("手动生成成功,保存了 " + savedRecords + " 条记录"); + + + } + @Test public void testCallConsultingScenarioWorkflow() { // 准备测试数据 Map inputs = new HashMap<>(); - inputs.put("unionId", "test_union_12345"); + inputs.put("unionId", "test_union_12346"); inputs.put("consultantId", "consultant_67890"); inputs.put("communicateDate", "2025-01-03 10:30:00"); inputs.put("analysisScene", "sales_consultation");