调整四合一ai结果

This commit is contained in:
zren25
2025-04-11 11:14:13 +08:00
parent 885fae12c5
commit a3e654485f

View File

@@ -6,9 +6,6 @@ import com.volvo.ai.analytic.center.constant.Constant;
import com.volvo.ai.analytic.center.dto.req.DiFyReq;
import com.volvo.ai.analytic.center.dto.req.FourInOneRequestDTO;
import com.volvo.ai.analytic.center.dto.req.RunMaskingRuleInput;
import com.volvo.ai.analytic.center.dto.resp.ComplainDTO;
import com.volvo.ai.analytic.center.dto.resp.ConsultDTO;
import com.volvo.ai.analytic.center.dto.resp.FourInOneResponseDTO;
import com.volvo.ai.analytic.center.entity.AiAnalysisErrors;
import com.volvo.ai.analytic.center.entity.AiAnalysisRequestLogs;
import com.volvo.ai.analytic.center.entity.DataMaskingRule;
@@ -19,6 +16,7 @@ import com.volvo.ai.analytic.center.feign.RemoteCarModelClient;
import com.volvo.ai.analytic.center.mapper.AiAnalysisErrorsMapper;
import com.volvo.ai.analytic.center.mapper.TcIntelligentCustomerMapper;
import com.volvo.ai.analytic.center.service.*;
import com.volvo.ai.analytic.center.utils.AiAnalysisUtils;
import com.volvo.ai.analytic.center.utils.ConstantStr;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -84,7 +82,7 @@ public class IntelligentCustomerServiceImpl implements IntelligentCustomerServic
public void fourInOneMqService(FourInOneRequestDTO fourInOneRequestDTO) {
if(null != fourInOneRequestDTO){
String aiAnalysisRequestId = StringUtils.isEmpty(fourInOneRequestDTO.getAiAnalysisRequestId())? AiAnalysisUtils.getAiAnalysisRequestId(BusinessTypeEnum.INTELLIGENT_CUSTOMER.getCode()):fourInOneRequestDTO.getAiAnalysisRequestId();
if (StringUtils.isEmpty(fourInOneRequestDTO.getWorkOrderSource()) || StringUtils.isEmpty(fourInOneRequestDTO.getWorkOrderContent())){
log.info("IntelligentCustomerMqConsumer WorkOrderSource or WorkOrderContent 为空不处理 ");
return ;
@@ -101,41 +99,18 @@ public class IntelligentCustomerServiceImpl implements IntelligentCustomerServic
inputMap.put("workOrderContent", fourInOneRequestDTO.getWorkOrderContent());
inputMap.put("relationCorpusContent", fourInOneRequestDTO.getRelationCorpusContent());
inputMap.put("laiyuan",fourInOneRequestDTO.getWorkOrderSource());
inputMap.put("workOrderId",fourInOneRequestDTO.getWorkOrderId());
inputMap.put("aiAnalysisRequestId", aiAnalysisRequestId);
diFyImageReq.setInputs(inputMap);
// 获取配置
JSONObject execDifyFlow = diFyService.executeDifyFlow(diFyImageReq, BusinessTypeEnum.INTELLIGENT_CUSTOMER.getCode(), JSONObject.toJSONString(fourInOneRequestDTO), fourInOneRequestDTO.getAiAnalysisRequestId());
JSONObject execDifyFlow = diFyService.executeDifyFlow(diFyImageReq, BusinessTypeEnum.INTELLIGENT_CUSTOMER.getCode(), JSONObject.toJSONString(fourInOneRequestDTO), aiAnalysisRequestId);
log.info("runDify execDifyFlow {}",execDifyFlow);
if(null != execDifyFlow && execDifyFlow.get("status").equals("succeeded")){
try {
JSONObject outputsJson = execDifyFlow.getJSONObject("outputs");
// 咨询
JSONObject textJsonObject =outputsJson.getJSONObject("text").getJSONObject("consult");
ConsultDTO consultDTO = new ConsultDTO();
consultDTO.setOrderType(fourInOneMqServiceFilter(IntelligentCustomerTypeEnum.CONSULT.getCode(),textJsonObject.getString("工单类别")));
consultDTO.setProblemDescription(textJsonObject.getString("问题描述"));
consultDTO.setContactSex(textJsonObject.getString("工单联系人性别"));
consultDTO.setContactName(textJsonObject.getString("工单联系人姓名"));
consultDTO.setContactTelephone(textJsonObject.getString("工单联系电话"));
// 投诉
JSONObject complainObject = outputsJson.getJSONObject("text1").getJSONObject("complain");
ComplainDTO complainDTO = new ComplainDTO();
complainDTO.setComplainType(fourInOneMqServiceFilter(IntelligentCustomerTypeEnum.CONSULT_TYPE.getCode(),complainObject.getString("投诉类型")));
complainDTO.setOrderType(fourInOneMqServiceFilter(IntelligentCustomerTypeEnum.COMPLAIN.getCode(),complainObject.getString("工单类别")));
complainDTO.setComplainTitle(complainObject.getString("投诉主题"));
complainDTO.setProblemDescription(complainObject.getString("问题描述"));
complainDTO.setContactSex(consultDTO.getContactSex());
complainDTO.setContactName(consultDTO.getContactName());
complainDTO.setContactTelephone(consultDTO.getContactTelephone());
FourInOneResponseDTO fourInOneResponseDTO = new FourInOneResponseDTO();
String aiAnalysisRequestId = execDifyFlow.getString("aiAnalysisRequestId");
fourInOneResponseDTO.setAiAnalysisRequestId(aiAnalysisRequestId);
fourInOneResponseDTO.setComplain(complainDTO);
fourInOneResponseDTO.setConsult(consultDTO);
fourInOneResponseDTO.setWorkOrderId(fourInOneRequestDTO.getWorkOrderId());
// 发送MQ
String message = JSONObject.toJSONString(fourInOneResponseDTO);
String message = JSONObject.toJSONString(outputsJson);
log.info("send mq {}",message);
sendMq(message);