Files
smartDriveEE/src/main/java/com/rj/service/biz/impl/CustomerProfileAnalysisServiceImpl.java
2025-10-06 12:17:34 +08:00

104 lines
2.9 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 {
log.info("保存客户画像分析结果开始,参数:{}", analysis);
boolean result = this.save(analysis);
if (result) {
log.info("客户画像分析结果保存成功ID: {}", analysis.getId());
CustomerProfileAnalysis ai17583471414673961 = this.getByProfileAnalysisRecordId(analysis.getProfileAnalysisRecordId());
log.info("获取AI_1758347141467_3961结果{}", ai17583471414673961);
} 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;
}
}
}