调用dify联调客户画像

This commit is contained in:
spllzh
2025-09-13 21:28:28 +08:00
parent 206275317f
commit d321af7e7c
53 changed files with 4783 additions and 345 deletions

View File

@@ -0,0 +1,37 @@
package com.rj.service.biz;
import com.baomidou.mybatisplus.extension.service.IService;
import com.rj.entity.CustomerProfileAnalysis;
/**
* 客户画像分析Service接口
*
* @author 李中华
* @date 2025/1/3
*/
public interface ICustomerProfileAnalysisService extends IService<CustomerProfileAnalysis> {
/**
* 保存客户画像分析结果
*
* @param analysis 客户画像分析结果
* @return 是否保存成功
*/
boolean saveCustomerProfileAnalysis(CustomerProfileAnalysis analysis);
/**
* 根据分析记录ID查询客户画像分析结果
*
* @param profileAnalysisRecordId 分析记录ID
* @return 客户画像分析结果
*/
CustomerProfileAnalysis getByProfileAnalysisRecordId(String profileAnalysisRecordId);
/**
* 根据业务ID查询客户画像分析结果
*
* @param businessId 业务ID
* @return 客户画像分析结果
*/
CustomerProfileAnalysis getByBusinessId(String businessId);
}

View File

@@ -0,0 +1,69 @@
package com.rj.service.biz.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rj.entity.CustomerProfileAnalysis;
import com.rj.mapper.CustomerProfileAnalysisMapper;
import com.rj.service.biz.ICustomerProfileAnalysisService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* 客户画像分析Service实现类
*
* @author 李中华
* @date 2025/1/3
*/
@Slf4j
@Service
public class CustomerProfileAnalysisServiceImpl extends ServiceImpl<CustomerProfileAnalysisMapper, CustomerProfileAnalysis>
implements ICustomerProfileAnalysisService {
@Override
public boolean saveCustomerProfileAnalysis(CustomerProfileAnalysis analysis) {
try {
boolean result = this.save(analysis);
if (result) {
log.info("客户画像分析结果保存成功ID: {}", analysis.getId());
} else {
log.error("客户画像分析结果保存失败");
}
return result;
} catch (Exception e) {
log.error("保存客户画像分析结果异常", e);
return false;
}
}
@Override
public CustomerProfileAnalysis getByProfileAnalysisRecordId(String profileAnalysisRecordId) {
try {
LambdaQueryWrapper<CustomerProfileAnalysis> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CustomerProfileAnalysis::getProfileAnalysisRecordId, profileAnalysisRecordId)
.eq(CustomerProfileAnalysis::getIsDeleted, 0)
.orderByDesc(CustomerProfileAnalysis::getCreatedAt)
.last("LIMIT 1");
return this.getOne(queryWrapper);
} catch (Exception e) {
log.error("根据分析记录ID查询客户画像分析结果异常", e);
return null;
}
}
@Override
public CustomerProfileAnalysis getByBusinessId(String businessId) {
try {
LambdaQueryWrapper<CustomerProfileAnalysis> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(CustomerProfileAnalysis::getRelatedBusinessId, businessId)
.eq(CustomerProfileAnalysis::getIsDeleted, 0)
.orderByDesc(CustomerProfileAnalysis::getCreatedAt)
.last("LIMIT 1");
return this.getOne(queryWrapper);
} catch (Exception e) {
log.error("根据业务ID查询客户画像分析结果异常", e);
return null;
}
}
}