审核流程

This commit is contained in:
lxu75
2025-04-11 15:38:43 +08:00
parent f5fb1f4fb6
commit 8e0c6c7e5b
3 changed files with 39 additions and 13 deletions

View File

@@ -19,6 +19,12 @@
</properties> </properties>
<dependencies> <dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.9</version> <!-- 请根据需要选择合适的版本 -->
</dependency>
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>

View File

@@ -2,7 +2,7 @@ package com.volvo.ai.analytic.center.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.volvo.ai.analytic.center.entity.AiAnalyticBusinessConfig; import com.volvo.ai.analytic.center.entity.AiAnalyticBusinessConfig;
import org.mapstruct.Mapper; import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface AiAnalyticBusinessConfigMapper extends BaseMapper<AiAnalyticBusinessConfig> { public interface AiAnalyticBusinessConfigMapper extends BaseMapper<AiAnalyticBusinessConfig> {

View File

@@ -12,7 +12,8 @@ import com.volvo.ai.analytic.center.dto.req.DiFyReq;
import com.volvo.ai.analytic.center.entity.AiAnalysisRequestLogs; import com.volvo.ai.analytic.center.entity.AiAnalysisRequestLogs;
import com.volvo.ai.analytic.center.entity.AiAnalyticBusinessConfig; import com.volvo.ai.analytic.center.entity.AiAnalyticBusinessConfig;
import com.volvo.ai.analytic.center.enums.BusinessTypeEnum; import com.volvo.ai.analytic.center.enums.BusinessTypeEnum;
import com.volvo.ai.analytic.center.enums.ClaimVerificationFileTypeEnums; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.StringEscapeUtils;
import com.volvo.ai.analytic.center.feign.DiFyFeign; import com.volvo.ai.analytic.center.feign.DiFyFeign;
import com.volvo.ai.analytic.center.mapper.AiAnalysisRequestLogsMapper; import com.volvo.ai.analytic.center.mapper.AiAnalysisRequestLogsMapper;
import com.volvo.ai.analytic.center.mapper.AiAnalyticBusinessConfigMapper; import com.volvo.ai.analytic.center.mapper.AiAnalyticBusinessConfigMapper;
@@ -30,6 +31,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream; import java.io.InputStream;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@Slf4j @Slf4j
@Service @Service
@@ -59,6 +61,9 @@ public class ClaimVerificationServiceImpl implements ClaimVerificationService {
@Value("${rocketmq.producer.claimVerification.topic}") @Value("${rocketmq.producer.claimVerification.topic}")
private String topic; private String topic;
@Value("${claimVerification.methodList}")
private List<String> methodList;
@Autowired @Autowired
private RocketMQTemplate rocketMQTemplate; private RocketMQTemplate rocketMQTemplate;
@Override @Override
@@ -86,6 +91,7 @@ public class ClaimVerificationServiceImpl implements ClaimVerificationService {
.eq(AiAnalyticBusinessConfig::getBusinessLine, BusinessTypeEnum.CLAIM_VERIFICATION.getCode()) .eq(AiAnalyticBusinessConfig::getBusinessLine, BusinessTypeEnum.CLAIM_VERIFICATION.getCode())
.eq(AiAnalyticBusinessConfig::getFileConfigCategory, claimVerificationFileAnalysisDTO.getFileType()) .eq(AiAnalyticBusinessConfig::getFileConfigCategory, claimVerificationFileAnalysisDTO.getFileType())
.eq(AiAnalyticBusinessConfig::getIsDeleted, 0) .eq(AiAnalyticBusinessConfig::getIsDeleted, 0)
.eq(AiAnalyticBusinessConfig::getConfigVersion, 1)
); );
//组装文件分析workflow入参 //组装文件分析workflow入参
@@ -137,11 +143,23 @@ public class ClaimVerificationServiceImpl implements ClaimVerificationService {
log.error(" 售后索赔检核文件分析dify返回结果为空"); log.error(" 售后索赔检核文件分析dify返回结果为空");
throw new RuntimeException(" 售后索赔检核文件分析dify返回结果为空"); throw new RuntimeException(" 售后索赔检核文件分析dify返回结果为空");
}else { }else {
String toAfter = "";
String textDoc = diFyObject.getString("textDoc");
String textImage = diFyObject.getString("textImage");
//判断字符串那个是不为空的然后进行处理
if (StringUtils.isNotBlank(textDoc)) {
toAfter = StringEscapeUtils.unescapeJava(textDoc);
} else if (StringUtils.isNotBlank(textImage)) {
toAfter = StringEscapeUtils.unescapeJava(textImage);
} else {
throw new RuntimeException(" 售后索赔检核文件分析dify返回结果为空");
}
JSONObject difyToAfter = JSONObject.parseObject(toAfter);
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
data.put("newBieAfterSalesId", claimVerificationFileAnalysisDTO.getNewBieAfterSalesId()); data.put("newBieAfterSalesId", claimVerificationFileAnalysisDTO.getNewBieAfterSalesId());
data.put("businessType", claimVerificationFileAnalysisDTO.getBusinessType()); data.put("businessType", claimVerificationFileAnalysisDTO.getBusinessType());
data.put("fileType", claimVerificationFileAnalysisDTO.getFileType()); data.put("fileType", claimVerificationFileAnalysisDTO.getFileType());
data.put("fileData",diFyObject); data.put("fileData",difyToAfter);
//返回结果推送到Newbie的MQ //返回结果推送到Newbie的MQ
rocketMQTemplate.syncSend(topic, data); rocketMQTemplate.syncSend(topic, data);
log.info("索赔检核文件分析发送回调MQ完成: {}", data); log.info("索赔检核文件分析发送回调MQ完成: {}", data);
@@ -150,22 +168,22 @@ public class ClaimVerificationServiceImpl implements ClaimVerificationService {
syncUpdateDiFyResponse(diFyObject, aiAnalysisRequestId); syncUpdateDiFyResponse(diFyObject, aiAnalysisRequestId);
} else if(claimVerificationFileAnalysisDTO.getBusinessType().equals(BusinessTypeEnum.CLAIM_VERIFICATION_AUDIT.getCode())){ } else if(claimVerificationFileAnalysisDTO.getBusinessType().equals(BusinessTypeEnum.CLAIM_VERIFICATION_AUDIT.getCode())){
//审计报告 //审计报告
//加载审计规则配置 //加载审计规则配置
List<AiAnalyticBusinessConfig> aiAnalyticBusinessConfigs = aiAnalyticBusinessConfigMapper.selectList( List<AiAnalyticBusinessConfig> aiAnalyticBusinessConfigs = aiAnalyticBusinessConfigMapper.selectList(
Wrappers.<AiAnalyticBusinessConfig>lambdaQuery() Wrappers.<AiAnalyticBusinessConfig>lambdaQuery()
.eq(AiAnalyticBusinessConfig::getBusinessLine, BusinessTypeEnum.CLAIM_VERIFICATION.getCode()) .eq(AiAnalyticBusinessConfig::getBusinessLine, BusinessTypeEnum.CLAIM_VERIFICATION.getCode())
.eq(AiAnalyticBusinessConfig::getConfigType, BusinessTypeEnum.AUDITRULES.getCode()) .eq(AiAnalyticBusinessConfig::getConfigType, BusinessTypeEnum.AUDITRULES.getCode())
.eq(AiAnalyticBusinessConfig::getIsDeleted, 0)); .eq(AiAnalyticBusinessConfig::getIsDeleted, 0)
.in(AiAnalyticBusinessConfig::getVerificationMethod,methodList)
)
;
String configDataString = aiAnalyticBusinessConfigs.stream()
.map(AiAnalyticBusinessConfig::getConfigData)
.collect(Collectors.joining(" "));
//组装审计报告workflow入参 //组装审计报告workflow入参
JSONObject auditRules = new JSONObject(); JSONObject auditRules = new JSONObject();
auditRules.put("analysisRules", aiAnalyticBusinessConfigs auditRules.put("analysisRules", configDataString);
.stream()
.filter(config -> config.getConfigType().equals("AuditRules"))
.map(AiAnalyticBusinessConfig::getConfigData)
.findFirst()
.orElse(null));
auditRules.put("diagnosticReport", claimVerificationFileAnalysisDTO.getDiagnosticReport()); auditRules.put("diagnosticReport", claimVerificationFileAnalysisDTO.getDiagnosticReport());
auditRules.put("preCheckReport", claimVerificationFileAnalysisDTO.getPreCheckReport()); auditRules.put("preCheckReport", claimVerificationFileAnalysisDTO.getPreCheckReport());
auditRules.put("dtcReport", claimVerificationFileAnalysisDTO.getDtcReport()); auditRules.put("dtcReport", claimVerificationFileAnalysisDTO.getDtcReport());
@@ -181,10 +199,13 @@ public class ClaimVerificationServiceImpl implements ClaimVerificationService {
log.error(" 售后索赔检核审计报告dify返回结果为空"); log.error(" 售后索赔检核审计报告dify返回结果为空");
throw new RuntimeException(" 售后索赔检核审计报告dify返回结果为空"); throw new RuntimeException(" 售后索赔检核审计报告dify返回结果为空");
}else { }else {
String warrantyAuditReport = diFyObject.getString("warrantyAuditReport");
warrantyAuditReport = StringEscapeUtils.unescapeJava(warrantyAuditReport);
JSONObject audiResToAfter = JSON.parseObject(warrantyAuditReport);
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
data.put("newBieAfterSalesId", claimVerificationFileAnalysisDTO.getNewBieAfterSalesId()); data.put("newBieAfterSalesId", claimVerificationFileAnalysisDTO.getNewBieAfterSalesId());
data.put("businessType", claimVerificationFileAnalysisDTO.getBusinessType()); data.put("businessType", claimVerificationFileAnalysisDTO.getBusinessType());
data.put("warrantyAuditReport",diFyObject); data.put("warrantyAuditReport",audiResToAfter);
//返回结果推送到Newbie的MQ //返回结果推送到Newbie的MQ
rocketMQTemplate.syncSend(topic, data); rocketMQTemplate.syncSend(topic, data);
log.info("索赔检核审计报告发送回调MQ完成: {}", data); log.info("索赔检核审计报告发送回调MQ完成: {}", data);
@@ -212,7 +233,6 @@ public class ClaimVerificationServiceImpl implements ClaimVerificationService {
} }
} }
@Async @Async
protected void syncUpdateDiFyResponse(JSONObject difResult, String aiAnalysisRequestId) { protected void syncUpdateDiFyResponse(JSONObject difResult, String aiAnalysisRequestId) {
aiAnalysisRequestLogsMapper.update(new AiAnalysisRequestLogs(), aiAnalysisRequestLogsMapper.update(new AiAnalysisRequestLogs(),