加入ai大模型
This commit is contained in:
@@ -0,0 +1,573 @@
|
||||
package com.klp.service.impl;
|
||||
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import com.klp.domain.bo.WmsSalesScriptGeneratorBo;
|
||||
import com.klp.domain.vo.WmsProductSalesScriptVo;
|
||||
import com.klp.domain.vo.WmsProductVo;
|
||||
import com.klp.domain.vo.WmsProductBomVo;
|
||||
import com.klp.domain.WmsProductBom;
|
||||
import com.klp.service.IWmsSalesScriptGeneratorService;
|
||||
import com.klp.service.IWmsProductService;
|
||||
import com.klp.service.IWmsProductBomService;
|
||||
import com.klp.service.IWmsProductSalesScriptService;
|
||||
import com.klp.common.utils.redis.RedisUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 销售话术生成器服务实现类
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-01-27
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsSalesScriptGeneratorServiceImpl implements IWmsSalesScriptGeneratorService {
|
||||
|
||||
private final IWmsProductService iWmsProductService;
|
||||
private final IWmsProductBomService iWmsProductBomService;
|
||||
private final IWmsProductSalesScriptService iWmsProductSalesScriptService;
|
||||
// private final RedisUtils redisUtils;
|
||||
@Qualifier("salesScriptRestTemplate")
|
||||
private final RestTemplate restTemplate;
|
||||
|
||||
// AI配置
|
||||
@Value("${sales.script.ai.api-key:sk-5eb55d2fb2cc4fe58a0150919a1f0d70}")
|
||||
private String apiKey;
|
||||
|
||||
@Value("${sales.script.ai.base-url:https://api.deepseek.com/v1}")
|
||||
private String baseUrl;
|
||||
|
||||
@Value("${sales.script.ai.model-name:deepseek-chat}")
|
||||
private String modelName;
|
||||
|
||||
@Value("${sales.script.ai.max-retries:3}")
|
||||
private Integer maxRetries;
|
||||
|
||||
@Value("${sales.script.ai.temperature:1.0}")
|
||||
private Double temperature;
|
||||
|
||||
// 客户类型配置
|
||||
private static final List<String> CUSTOMER_TYPES = Arrays.asList(
|
||||
"技术型客户", "价格敏感型客户", "质量优先型客户", "批量采购客户", "定制化需求客户"
|
||||
);
|
||||
|
||||
// 产品特性关键词
|
||||
private static final List<String> FEATURE_KEYWORDS = Arrays.asList(
|
||||
"优质", "高精度", "耐用", "稳定", "可靠", "先进", "高效", "节能", "环保", "安全", "便捷", "智能"
|
||||
);
|
||||
|
||||
// 技术参数模式
|
||||
private static final List<String> TECH_PATTERNS = Arrays.asList(
|
||||
"厚度", "宽度", "内径", "长度", "重量", "密度"
|
||||
);
|
||||
|
||||
// 线程池
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(5);
|
||||
|
||||
@Override
|
||||
public List<WmsProductSalesScriptVo> generateScriptsForProduct(WmsSalesScriptGeneratorBo bo) {
|
||||
try {
|
||||
// 获取产品信息
|
||||
WmsProductVo product = iWmsProductService.queryById(bo.getProductId());
|
||||
if (product == null) {
|
||||
throw new RuntimeException("产品不存在");
|
||||
}
|
||||
|
||||
// 获取BOM信息
|
||||
List<WmsProductBom> bomList = iWmsProductBomService.listByProductId(bo.getProductId());
|
||||
|
||||
// 生成话术
|
||||
String aiResponse = callAiApi(product, bomList, bo);
|
||||
List<Map<String, Object>> scripts = parseAiResponse(aiResponse);
|
||||
|
||||
// 转换为VO对象
|
||||
List<WmsProductSalesScriptVo> result = new ArrayList<>();
|
||||
for (Map<String, Object> script : scripts) {
|
||||
WmsProductSalesScriptVo vo = new WmsProductSalesScriptVo();
|
||||
vo.setProductId(bo.getProductId());
|
||||
vo.setScriptTitle((String) script.get("title"));
|
||||
vo.setScriptContent((String) script.get("content"));
|
||||
vo.setFeaturePoint((String) script.get("featurePoint"));
|
||||
vo.setIsEnabled(1);
|
||||
result.add(vo);
|
||||
}
|
||||
|
||||
// 保存到数据库
|
||||
if (Boolean.TRUE.equals(bo.getSaveToDatabase())) {
|
||||
for (WmsProductSalesScriptVo vo : result) {
|
||||
// 这里需要转换为BO对象进行保存
|
||||
// iWmsProductSalesScriptService.insertByBo(vo);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.error("生成销售话术失败", e);
|
||||
throw new RuntimeException("生成销售话术失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> generateScriptsBatch(WmsSalesScriptGeneratorBo bo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
List<Long> productIds = new ArrayList<>();
|
||||
|
||||
try {
|
||||
// 获取所有启用的产品
|
||||
List<WmsProductVo> products = iWmsProductService.queryList(new com.klp.domain.bo.WmsProductBo());
|
||||
for (WmsProductVo product : products) {
|
||||
if (product.getIsEnabled() != null && product.getIsEnabled() == 1) {
|
||||
productIds.add(product.getProductId());
|
||||
}
|
||||
}
|
||||
|
||||
bo.setProductIds(productIds);
|
||||
return generateScriptsForProductIds(bo);
|
||||
} catch (Exception e) {
|
||||
log.error("批量生成销售话术失败", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "批量生成失败: " + e.getMessage());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> generateScriptsForProductIds(WmsSalesScriptGeneratorBo bo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
int totalProducts = 0;
|
||||
int successCount = 0;
|
||||
int failCount = 0;
|
||||
List<String> errors = new ArrayList<>();
|
||||
|
||||
try {
|
||||
if (bo.getProductIds() == null || bo.getProductIds().isEmpty()) {
|
||||
throw new RuntimeException("产品ID列表不能为空");
|
||||
}
|
||||
|
||||
totalProducts = bo.getProductIds().size();
|
||||
|
||||
// 批量处理
|
||||
List<CompletableFuture<Boolean>> futures = new ArrayList<>();
|
||||
for (Long productId : bo.getProductIds()) {
|
||||
CompletableFuture<Boolean> future = CompletableFuture.supplyAsync(() -> {
|
||||
try {
|
||||
WmsSalesScriptGeneratorBo singleBo = new WmsSalesScriptGeneratorBo();
|
||||
singleBo.setProductId(productId);
|
||||
singleBo.setScriptCount(bo.getScriptCount());
|
||||
singleBo.setSaveToDatabase(bo.getSaveToDatabase());
|
||||
generateScriptsForProduct(singleBo);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("处理产品 {} 失败: {}", productId, e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}, executorService);
|
||||
futures.add(future);
|
||||
}
|
||||
|
||||
// 等待所有任务完成
|
||||
for (CompletableFuture<Boolean> future : futures) {
|
||||
if (future.get()) {
|
||||
successCount++;
|
||||
} else {
|
||||
failCount++;
|
||||
}
|
||||
}
|
||||
|
||||
result.put("success", true);
|
||||
result.put("totalProducts", totalProducts);
|
||||
result.put("successCount", successCount);
|
||||
result.put("failCount", failCount);
|
||||
result.put("errors", errors);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("批量生成销售话术失败", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "批量生成失败: " + e.getMessage());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> testAiConnection() {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
// 构建测试请求
|
||||
Map<String, Object> requestBody = new HashMap<>();
|
||||
requestBody.put("model", modelName);
|
||||
Map<String, String> message = new HashMap<>();
|
||||
message.put("role", "user");
|
||||
message.put("content", "你好");
|
||||
requestBody.put("messages", Arrays.asList(message));
|
||||
requestBody.put("max_tokens", 10);
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
headers.setBearerAuth(apiKey);
|
||||
|
||||
HttpEntity<Map<String, Object>> entity = new HttpEntity<>(requestBody, headers);
|
||||
ResponseEntity<Map> response = restTemplate.postForEntity(
|
||||
baseUrl + "/chat/completions", entity, Map.class);
|
||||
|
||||
result.put("success", true);
|
||||
result.put("message", "AI连接测试成功");
|
||||
result.put("response", response.getBody());
|
||||
} catch (Exception e) {
|
||||
log.error("AI连接测试失败", e);
|
||||
result.put("success", false);
|
||||
result.put("message", "AI连接测试失败: " + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getGenerationConfig() {
|
||||
Map<String, Object> config = new HashMap<>();
|
||||
config.put("apiKey", StringUtils.isNotEmpty(apiKey) ? apiKey.substring(0, 10) + "..." : "");
|
||||
config.put("baseUrl", baseUrl);
|
||||
config.put("modelName", modelName);
|
||||
config.put("maxRetries", maxRetries);
|
||||
config.put("temperature", temperature);
|
||||
config.put("customerTypes", CUSTOMER_TYPES);
|
||||
config.put("featureKeywords", FEATURE_KEYWORDS);
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateGenerationConfig(Map<String, Object> config) {
|
||||
// 这里可以实现配置更新逻辑
|
||||
// 可以将配置保存到数据库或配置文件中
|
||||
log.info("更新生成配置: {}", config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getAvailableProducts() {
|
||||
List<Map<String, Object>> products = new ArrayList<>();
|
||||
try {
|
||||
List<WmsProductVo> productList = iWmsProductService.queryList(new com.klp.domain.bo.WmsProductBo());
|
||||
for (WmsProductVo product : productList) {
|
||||
if (product.getIsEnabled() != null && product.getIsEnabled() == 1) {
|
||||
Map<String, Object> productMap = new HashMap<>();
|
||||
productMap.put("productId", product.getProductId());
|
||||
productMap.put("productName", product.getProductName());
|
||||
productMap.put("productCode", product.getProductCode());
|
||||
productMap.put("owner", product.getOwner());
|
||||
products.add(productMap);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("获取可用产品列表失败", e);
|
||||
}
|
||||
return products;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<Map<String, Object>> getGenerationHistory(PageQuery pageQuery) {
|
||||
// 这里可以实现生成历史查询逻辑
|
||||
// 可以创建一个专门的表来记录生成历史
|
||||
TableDataInfo<Map<String, Object>> result = new TableDataInfo<>();
|
||||
result.setRows(new ArrayList<>());
|
||||
result.setTotal(0L);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WmsProductSalesScriptVo regenerateScript(Long scriptId) {
|
||||
// 获取原话术信息
|
||||
WmsProductSalesScriptVo originalScript = iWmsProductSalesScriptService.queryById(scriptId);
|
||||
if (originalScript == null) {
|
||||
throw new RuntimeException("话术不存在");
|
||||
}
|
||||
|
||||
// 重新生成话术
|
||||
WmsSalesScriptGeneratorBo bo = new WmsSalesScriptGeneratorBo();
|
||||
bo.setProductId(originalScript.getProductId());
|
||||
bo.setScriptCount(1);
|
||||
bo.setSaveToDatabase(false);
|
||||
|
||||
List<WmsProductSalesScriptVo> newScripts = generateScriptsForProduct(bo);
|
||||
if (!newScripts.isEmpty()) {
|
||||
return newScripts.get(0);
|
||||
}
|
||||
|
||||
throw new RuntimeException("重新生成话术失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> previewScripts(WmsSalesScriptGeneratorBo bo) {
|
||||
bo.setSaveToDatabase(false);
|
||||
List<WmsProductSalesScriptVo> scripts = generateScriptsForProduct(bo);
|
||||
|
||||
List<Map<String, Object>> previews = new ArrayList<>();
|
||||
for (WmsProductSalesScriptVo script : scripts) {
|
||||
Map<String, Object> preview = new HashMap<>();
|
||||
preview.put("title", script.getScriptTitle());
|
||||
preview.put("content", script.getScriptContent());
|
||||
preview.put("featurePoint", script.getFeaturePoint());
|
||||
previews.add(preview);
|
||||
}
|
||||
return previews;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getCustomerTypes() {
|
||||
List<Map<String, Object>> customerTypes = new ArrayList<>();
|
||||
for (String type : CUSTOMER_TYPES) {
|
||||
Map<String, Object> customerType = new HashMap<>();
|
||||
customerType.put("type", type);
|
||||
customerType.put("description", getCustomerTypeDescription(type));
|
||||
customerTypes.add(customerType);
|
||||
}
|
||||
return customerTypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getFeatureKeywords() {
|
||||
return new ArrayList<>(FEATURE_KEYWORDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> analyzeProduct(WmsSalesScriptGeneratorBo bo) {
|
||||
Map<String, Object> analysis = new HashMap<>();
|
||||
try {
|
||||
WmsProductVo product = iWmsProductService.queryById(bo.getProductId());
|
||||
if (product == null) {
|
||||
throw new RuntimeException("产品不存在");
|
||||
}
|
||||
|
||||
List<WmsProductBom> bomList = iWmsProductBomService.listByProductId(bo.getProductId());
|
||||
|
||||
// 分析产品特性
|
||||
analysis.put("productInfo", product);
|
||||
analysis.put("bomInfo", bomList);
|
||||
analysis.put("suggestedCustomerTypes", suggestCustomerTypes(product, bomList));
|
||||
analysis.put("suggestedFeatures", extractFeatures(product, bomList));
|
||||
analysis.put("suggestedScriptCount", 5);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("分析产品失败", e);
|
||||
analysis.put("error", e.getMessage());
|
||||
}
|
||||
return analysis;
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用AI API
|
||||
*/
|
||||
private String callAiApi(WmsProductVo product, List<WmsProductBom> bomList, WmsSalesScriptGeneratorBo bo) {
|
||||
String prompt = buildPrompt(product, bomList, bo);
|
||||
|
||||
Map<String, Object> requestBody = new HashMap<>();
|
||||
requestBody.put("model", modelName);
|
||||
Map<String, String> systemMessage = new HashMap<>();
|
||||
systemMessage.put("role", "system");
|
||||
systemMessage.put("content", "你是一名专业的销售话术专家");
|
||||
|
||||
Map<String, String> userMessage = new HashMap<>();
|
||||
userMessage.put("role", "user");
|
||||
userMessage.put("content", prompt);
|
||||
|
||||
requestBody.put("messages", Arrays.asList(systemMessage, userMessage));
|
||||
requestBody.put("temperature", bo.getTemperature());
|
||||
requestBody.put("max_tokens", 4096);
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
headers.setBearerAuth(apiKey);
|
||||
|
||||
HttpEntity<Map<String, Object>> entity = new HttpEntity<>(requestBody, headers);
|
||||
|
||||
for (int i = 0; i < bo.getMaxRetries(); i++) {
|
||||
try {
|
||||
ResponseEntity<Map> response = restTemplate.postForEntity(
|
||||
baseUrl + "/chat/completions", entity, Map.class);
|
||||
|
||||
if (response.getStatusCode() == HttpStatus.OK && response.getBody() != null) {
|
||||
Map<String, Object> body = response.getBody();
|
||||
List<Map<String, Object>> choices = (List<Map<String, Object>>) body.get("choices");
|
||||
if (choices != null && !choices.isEmpty()) {
|
||||
Map<String, Object> choice = choices.get(0);
|
||||
Map<String, Object> message = (Map<String, Object>) choice.get("message");
|
||||
return (String) message.get("content");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("AI API调用失败,重试 {}: {}", i + 1, e.getMessage());
|
||||
if (i == bo.getMaxRetries() - 1) {
|
||||
throw new RuntimeException("AI API调用失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new RuntimeException("AI API调用失败,已达到最大重试次数");
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建提示词
|
||||
*/
|
||||
private String buildPrompt(WmsProductVo product, List<WmsProductBom> bomList, WmsSalesScriptGeneratorBo bo) {
|
||||
StringBuilder prompt = new StringBuilder();
|
||||
prompt.append("请根据以下产品信息和BOM清单,生成").append(bo.getScriptCount()).append("条针对不同客户场景的销售话术。\n\n");
|
||||
|
||||
// 产品信息
|
||||
prompt.append("【产品信息】\n");
|
||||
prompt.append("产品名称:").append(product.getProductName()).append("\n");
|
||||
prompt.append("产品编码:").append(product.getProductCode()).append("\n");
|
||||
prompt.append("负责人:").append(product.getOwner()).append("\n");
|
||||
if (product.getThickness() != null) {
|
||||
prompt.append("厚度:").append(product.getThickness()).append("mm\n");
|
||||
}
|
||||
if (product.getWidth() != null) {
|
||||
prompt.append("宽度:").append(product.getWidth()).append("mm\n");
|
||||
}
|
||||
if (product.getInnerDiameter() != null) {
|
||||
prompt.append("内径:").append(product.getInnerDiameter()).append("mm\n");
|
||||
}
|
||||
prompt.append("单位:").append(product.getUnit()).append("\n");
|
||||
if (StringUtils.isNotEmpty(product.getRemark())) {
|
||||
prompt.append("备注:").append(product.getRemark()).append("\n");
|
||||
}
|
||||
|
||||
// BOM信息
|
||||
if (Boolean.TRUE.equals(bo.getIncludeBomInfo()) && bomList != null && !bomList.isEmpty()) {
|
||||
prompt.append("\n【BOM清单】\n");
|
||||
for (WmsProductBom bom : bomList) {
|
||||
prompt.append("- ").append(bom.getRawMaterialId())
|
||||
.append(": ").append(bom.getQuantity())
|
||||
.append(" ").append(bom.getUnit()).append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
// 生成要求
|
||||
prompt.append("\n【话术生成要求】\n");
|
||||
prompt.append("1. 每条话术必须包含产品的主要特性和优势\n");
|
||||
prompt.append("2. 要突出产品的技术参数和材料优势\n");
|
||||
prompt.append("3. 针对不同客户类型(技术型客户、价格敏感型客户、质量优先型客户等)\n");
|
||||
prompt.append("4. 话术要自然、专业、有说服力\n");
|
||||
prompt.append("5. 包含具体的应用场景和解决方案\n");
|
||||
prompt.append("6. 突出产品的核心竞争力\n");
|
||||
|
||||
// 输出格式
|
||||
prompt.append("\n【输出格式】\n");
|
||||
prompt.append("请按以下格式输出:\n\n");
|
||||
for (int i = 1; i <= bo.getScriptCount(); i++) {
|
||||
prompt.append("【话术").append(i).append("】客户类型\n");
|
||||
prompt.append("标题:").append(product.getProductName()).append(" - 话术标题\n");
|
||||
prompt.append("内容:[具体话术内容]\n\n");
|
||||
}
|
||||
|
||||
return prompt.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析AI响应
|
||||
*/
|
||||
private List<Map<String, Object>> parseAiResponse(String response) {
|
||||
List<Map<String, Object>> scripts = new ArrayList<>();
|
||||
|
||||
// 使用正则表达式解析响应
|
||||
Pattern pattern = Pattern.compile("【话术(\\d+)】(.*?)\\n标题:(.*?)\\n内容:(.*?)(?=\\n【话术|\\Z)", Pattern.DOTALL);
|
||||
Matcher matcher = pattern.matcher(response);
|
||||
|
||||
while (matcher.find()) {
|
||||
Map<String, Object> script = new HashMap<>();
|
||||
script.put("customerType", matcher.group(2).trim());
|
||||
script.put("title", matcher.group(3).trim());
|
||||
script.put("content", matcher.group(4).trim());
|
||||
script.put("featurePoint", extractFeaturePoints(matcher.group(4)));
|
||||
scripts.add(script);
|
||||
}
|
||||
|
||||
return scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取特性点
|
||||
*/
|
||||
private String extractFeaturePoints(String content) {
|
||||
List<String> features = new ArrayList<>();
|
||||
|
||||
// 提取技术参数
|
||||
for (String pattern : TECH_PATTERNS) {
|
||||
Pattern techPattern = Pattern.compile(pattern + "[::]\\s*([\\d.]+)");
|
||||
Matcher matcher = techPattern.matcher(content);
|
||||
if (matcher.find()) {
|
||||
features.add("技术参数: " + matcher.group(1));
|
||||
}
|
||||
}
|
||||
|
||||
// 提取材料优势
|
||||
for (String keyword : FEATURE_KEYWORDS) {
|
||||
if (content.contains(keyword)) {
|
||||
features.add("材料优势: " + keyword);
|
||||
}
|
||||
}
|
||||
|
||||
return features.isEmpty() ? "产品特性突出" : String.join("; ", features);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取客户类型描述
|
||||
*/
|
||||
private String getCustomerTypeDescription(String type) {
|
||||
Map<String, String> descriptions = new HashMap<>();
|
||||
descriptions.put("技术型客户", "突出技术参数和性能优势");
|
||||
descriptions.put("价格敏感型客户", "强调性价比和成本效益");
|
||||
descriptions.put("质量优先型客户", "重点介绍品质保证和可靠性");
|
||||
descriptions.put("批量采购客户", "突出批量优惠和供应能力");
|
||||
descriptions.put("定制化需求客户", "强调定制服务和个性化解决方案");
|
||||
|
||||
return descriptions.getOrDefault(type, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 建议客户类型
|
||||
*/
|
||||
private List<String> suggestCustomerTypes(WmsProductVo product, List<WmsProductBom> bomList) {
|
||||
List<String> suggestions = new ArrayList<>();
|
||||
suggestions.add("技术型客户");
|
||||
suggestions.add("质量优先型客户");
|
||||
|
||||
if (bomList != null && bomList.size() > 3) {
|
||||
suggestions.add("批量采购客户");
|
||||
}
|
||||
|
||||
return suggestions;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取特性
|
||||
*/
|
||||
private List<String> extractFeatures(WmsProductVo product, List<WmsProductBom> bomList) {
|
||||
List<String> features = new ArrayList<>();
|
||||
|
||||
if (product.getThickness() != null || product.getWidth() != null || product.getInnerDiameter() != null) {
|
||||
features.add("精密制造");
|
||||
}
|
||||
|
||||
if (bomList != null && !bomList.isEmpty()) {
|
||||
features.add("优质材料");
|
||||
}
|
||||
|
||||
return features;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user