调用dify联调客户画像
This commit is contained in:
@@ -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);
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user