加入ai大模型
This commit is contained in:
@@ -0,0 +1,157 @@
|
||||
package com.klp.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.domain.bo.WmsSalesScriptGeneratorBo;
|
||||
import com.klp.domain.vo.WmsProductSalesScriptVo;
|
||||
import com.klp.service.IWmsSalesScriptGeneratorService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* 销售话术生成器
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-01-27
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/wms/salesScriptGenerator")
|
||||
public class WmsSalesScriptGeneratorController extends BaseController {
|
||||
|
||||
private final IWmsSalesScriptGeneratorService iWmsSalesScriptGeneratorService;
|
||||
|
||||
/**
|
||||
* 为单个产品生成销售话术
|
||||
*/
|
||||
@Log(title = "销售话术生成", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/generateForProduct")
|
||||
public R<List<WmsProductSalesScriptVo>> generateForProduct(@RequestBody WmsSalesScriptGeneratorBo bo) {
|
||||
List<WmsProductSalesScriptVo> scripts = iWmsSalesScriptGeneratorService.generateScriptsForProduct(bo);
|
||||
return R.ok(scripts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量生成销售话术
|
||||
*/
|
||||
@Log(title = "批量销售话术生成", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/generateBatch")
|
||||
public R<Map<String, Object>> generateBatch(@RequestBody WmsSalesScriptGeneratorBo bo) {
|
||||
Map<String, Object> result = iWmsSalesScriptGeneratorService.generateScriptsBatch(bo);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 为指定产品ID列表生成话术
|
||||
*/
|
||||
@Log(title = "指定产品话术生成", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/generateForProductIds")
|
||||
public R<Map<String, Object>> generateForProductIds(@RequestBody WmsSalesScriptGeneratorBo bo) {
|
||||
Map<String, Object> result = iWmsSalesScriptGeneratorService.generateScriptsForProductIds(bo);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试AI连接
|
||||
*/
|
||||
@GetMapping("/testConnection")
|
||||
public R<Map<String, Object>> testConnection() {
|
||||
Map<String, Object> result = iWmsSalesScriptGeneratorService.testAiConnection();
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取生成配置
|
||||
*/
|
||||
@GetMapping("/config")
|
||||
public R<Map<String, Object>> getConfig() {
|
||||
Map<String, Object> config = iWmsSalesScriptGeneratorService.getGenerationConfig();
|
||||
return R.ok(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新生成配置
|
||||
*/
|
||||
@Log(title = "更新话术生成配置", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/config")
|
||||
public R<Void> updateConfig(@RequestBody Map<String, Object> config) {
|
||||
iWmsSalesScriptGeneratorService.updateGenerationConfig(config);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取可用的产品列表
|
||||
*/
|
||||
@GetMapping("/availableProducts")
|
||||
public R<List<Map<String, Object>>> getAvailableProducts() {
|
||||
List<Map<String, Object>> products = iWmsSalesScriptGeneratorService.getAvailableProducts();
|
||||
return R.ok(products);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取生成历史
|
||||
*/
|
||||
@GetMapping("/history")
|
||||
public TableDataInfo<Map<String, Object>> getGenerationHistory(PageQuery pageQuery) {
|
||||
return iWmsSalesScriptGeneratorService.getGenerationHistory(pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新生成指定话术
|
||||
*/
|
||||
@Log(title = "重新生成话术", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/regenerate/{scriptId}")
|
||||
public R<WmsProductSalesScriptVo> regenerateScript(@NotNull(message = "话术ID不能为空")
|
||||
@PathVariable Long scriptId) {
|
||||
WmsProductSalesScriptVo script = iWmsSalesScriptGeneratorService.regenerateScript(scriptId);
|
||||
return R.ok(script);
|
||||
}
|
||||
|
||||
/**
|
||||
* 预览话术生成(不保存到数据库)
|
||||
*/
|
||||
@PostMapping("/preview")
|
||||
public R<List<Map<String, Object>>> previewScripts(@RequestBody WmsSalesScriptGeneratorBo bo) {
|
||||
List<Map<String, Object>> previews = iWmsSalesScriptGeneratorService.previewScripts(bo);
|
||||
return R.ok(previews);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取客户类型列表
|
||||
*/
|
||||
@GetMapping("/customerTypes")
|
||||
public R<List<Map<String, Object>>> getCustomerTypes() {
|
||||
List<Map<String, Object>> customerTypes = iWmsSalesScriptGeneratorService.getCustomerTypes();
|
||||
return R.ok(customerTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品特性关键词
|
||||
*/
|
||||
@GetMapping("/featureKeywords")
|
||||
public R<List<String>> getFeatureKeywords() {
|
||||
List<String> keywords = iWmsSalesScriptGeneratorService.getFeatureKeywords();
|
||||
return R.ok(keywords);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分析产品信息并生成话术建议
|
||||
*/
|
||||
@PostMapping("/analyzeProduct")
|
||||
public R<Map<String, Object>> analyzeProduct(@RequestBody WmsSalesScriptGeneratorBo bo) {
|
||||
Map<String, Object> analysis = iWmsSalesScriptGeneratorService.analyzeProduct(bo);
|
||||
return R.ok(analysis);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user