调用dify联调客户画像
This commit is contained in:
@@ -101,6 +101,10 @@ public class PasswordUtil {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -87,6 +87,10 @@ public class ServiceManager {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -68,3 +68,7 @@ public class AliyunConfig {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
package com.rj.controller.biz;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.rj.entity.bz.DifyWorkflowAnalysis;
|
||||
|
||||
import com.rj.service.biz.IDifyWorkflowAnalysisService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Dify工作流分析结果控制器
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/biz/dify-analysis")
|
||||
public class DifyWorkflowAnalysisController {
|
||||
|
||||
@Autowired
|
||||
private IDifyWorkflowAnalysisService difyWorkflowAnalysisService;
|
||||
|
||||
/**
|
||||
* 保存Dify工作流分析结果
|
||||
*/
|
||||
@PostMapping
|
||||
public boolean saveAnalysis(@RequestBody DifyWorkflowAnalysis analysis) {
|
||||
try {
|
||||
return difyWorkflowAnalysisService.save(analysis);
|
||||
} catch (Exception e) {
|
||||
log.error("保存Dify工作流分析结果失败", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID获取分析结果
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public DifyWorkflowAnalysis getAnalysisById(@PathVariable String id) {
|
||||
return difyWorkflowAnalysisService.getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分析记录ID获取分析结果
|
||||
*/
|
||||
@GetMapping("/record/{recordId}")
|
||||
public List<DifyWorkflowAnalysis> getAnalysisByRecordId(@PathVariable String recordId) {
|
||||
QueryWrapper<DifyWorkflowAnalysis> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("analysis_record_id", recordId);
|
||||
return difyWorkflowAnalysisService.list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询分析结果
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Page<DifyWorkflowAnalysis> getAnalysisPage(
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
Page<DifyWorkflowAnalysis> page = new Page<>(pageNum, pageSize);
|
||||
return difyWorkflowAnalysisService.page(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据顾问ID查询分析结果
|
||||
*/
|
||||
@GetMapping("/consultant/{consultantId}")
|
||||
public List<DifyWorkflowAnalysis> getAnalysisByConsultantId(@PathVariable String consultantId) {
|
||||
QueryWrapper<DifyWorkflowAnalysis> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("consultant_id", consultantId);
|
||||
return difyWorkflowAnalysisService.list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据客户unionId查询分析结果
|
||||
*/
|
||||
@GetMapping("/customer/{unionId}")
|
||||
public List<DifyWorkflowAnalysis> getAnalysisByUnionId(@PathVariable String unionId) {
|
||||
QueryWrapper<DifyWorkflowAnalysis> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("union_id", unionId);
|
||||
return difyWorkflowAnalysisService.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
@@ -184,6 +184,10 @@ public class AuthController {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -323,6 +323,10 @@ public class MenuController {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -293,6 +293,10 @@ public class RoleController {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -299,6 +299,10 @@ public class UserRoleController {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -70,3 +70,7 @@ public class DifyWorkflowResponseDto {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class EnbedingModelConfig {
|
||||
// @Primary
|
||||
public EmbeddingStore embeddingStoreInMemory() {
|
||||
//1 , 加载知识库文档进 内存
|
||||
List<Document> documents = ClassPathDocumentLoader.loadDocuments("knowledge");
|
||||
List<Document> documents =ClassPathDocumentLoader.loadDocuments("knowledge"); //暂时去掉 2025-09-20
|
||||
//2 , 构建向量数据库操作对象
|
||||
InMemoryEmbeddingStore<TextSegment> embeddingStore = new InMemoryEmbeddingStore<>();
|
||||
//3, 构建EmbeddingStoreIngestor , 完成文本数据的切割, 向量化, 存储
|
||||
|
||||
@@ -14,3 +14,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
public interface CustomerProfileAnalysisMapper extends BaseMapper<CustomerProfileAnalysis> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -50,6 +50,10 @@ public class LoginResponse {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -72,5 +72,9 @@ public class AudioStatisticsScheduler {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.rj.scheduler;
|
||||
|
||||
/**
|
||||
* Author: 李中华 wx: spllzh email(qq): 28668817@qq.com
|
||||
* Date: 2025/9/20 9:30
|
||||
**/
|
||||
public class CustomerProfileStatisticScheduler {
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.rj.entity.bz.DifyWorkflowAnalysis;
|
||||
import com.rj.entity.CustomerProfileAnalysis;
|
||||
import com.rj.service.biz.IDifyWorkflowAnalysisService;
|
||||
import com.rj.service.biz.ICustomerProfileAnalysisService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -47,9 +46,6 @@ public class DifyWorkflowService {
|
||||
|
||||
private final RestTemplate restTemplate;
|
||||
|
||||
@Autowired
|
||||
private IDifyWorkflowAnalysisService difyWorkflowAnalysisService;
|
||||
|
||||
@Autowired
|
||||
private ICustomerProfileAnalysisService customerProfileAnalysisService;
|
||||
|
||||
@@ -325,12 +321,12 @@ public class DifyWorkflowService {
|
||||
analysis.setUpdatedAt(now);
|
||||
|
||||
// 保存到数据库
|
||||
boolean saveResult = difyWorkflowAnalysisService.save(analysis);
|
||||
if (saveResult) {
|
||||
log.info("分析结果保存成功,ID: {}", analysis.getId());
|
||||
} else {
|
||||
log.error("分析结果保存失败");
|
||||
}
|
||||
// boolean saveResult = difyWorkflowAnalysisService.save(analysis);
|
||||
// if (saveResult) {
|
||||
// log.info("分析结果保存成功,ID: {}", analysis.getId());
|
||||
// } else {
|
||||
// log.error("分析结果保存失败");
|
||||
// }
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("保存分析结果到数据库失败", e);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.rj.service.biz;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.rj.entity.bz.DifyWorkflowAnalysis;
|
||||
|
||||
@@ -11,5 +12,5 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class DifyWorkflowAnalysisServiceImpl extends ServiceImpl<DifyWorkflowAnalysisMapper, DifyWorkflowAnalysis>
|
||||
implements IDifyWorkflowAnalysisService {
|
||||
implements IService<DifyWorkflowAnalysis> {
|
||||
}
|
||||
|
||||
@@ -35,3 +35,7 @@ public interface ICustomerProfileAnalysisService extends IService<CustomerProfil
|
||||
*/
|
||||
CustomerProfileAnalysis getByBusinessId(String businessId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.rj.service.biz;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.rj.entity.bz.DifyWorkflowAnalysis;
|
||||
|
||||
/**
|
||||
* Dify工作流分析结果服务接口
|
||||
*/
|
||||
public interface IDifyWorkflowAnalysisService extends IService<DifyWorkflowAnalysis> {
|
||||
}
|
||||
@@ -67,3 +67,7 @@ public class CustomerProfileAnalysisServiceImpl extends ServiceImpl<CustomerProf
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +32,10 @@ public interface IMenuService extends IService<Menu> {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +32,10 @@ public interface IUserRoleService extends IService<UserRole> {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -36,6 +36,10 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -36,6 +36,10 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -36,6 +36,10 @@ public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> i
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user