定位流程中断

This commit is contained in:
ZLI263
2025-09-20 15:52:08 +08:00
parent 887709db51
commit 5326a6f431

View File

@@ -111,8 +111,8 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
private String aiAnalysisRequestIdStr = "aiAnalysisRequestId";
@Override
public void runTelephoneCorpusDify(AicorpusTelephoneDTO aicorpusTelephone) {
if(null != aicorpusTelephone){
try {
if (null != aicorpusTelephone) {
List<DataMaskingRule> maskingRuleItems = dataMaskingRuleService.getDataMaskingRuleListByApplicationChannel(BusinessTypeEnum.SMART_ASSISTANT.getCode());
@@ -124,12 +124,11 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
diFyImageReq.setUser(ConstantStr.corpus_user);
JSONObject jsonObject = JSONObject.parseObject( aicorpusTelephone.getDisplay());
inputMap.put("chat",aicorpusTelephone.getDisplay());
JSONObject jsonObject = JSONObject.parseObject(aicorpusTelephone.getDisplay());
log.info("电话语料内容:{}", jsonObject.toString());
inputMap.put("chat", aicorpusTelephone.getDisplay());
JSONArray segments = jsonObject.getJSONArray("segments");
log.info("电话语料内容segments{}", segments.toString());
// 遍历 segments
StringBuffer chatList = new StringBuffer();
segments.stream()
@@ -139,11 +138,11 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
String text = result.getString("text");
JSONObject analysisInfo = result.getJSONObject("analysis_info");
String role = analysisInfo.getString("role");
String title="";
if(role.equals("AGENT")){
title="顾问";
}else{
title="客户";
String title = "";
if (role.equals("AGENT")) {
title = "顾问";
} else {
title = "客户";
}
// 拼接 role 和 text
String chat = title + ": " + text;
@@ -157,10 +156,10 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String formattedDateStartTime = zonedDateTime.format(formatter);
inputMap.put("chat",chatList.toString());
inputMap.put("model",getCarModelList());
inputMap.put("recordId",aicorpusTelephone.getSourceId());
inputMap.put("version",2);
inputMap.put("chat", chatList.toString());
inputMap.put("model", getCarModelList());
inputMap.put("recordId", aicorpusTelephone.getSourceId());
inputMap.put("version", 2);
diFyImageReq.setInputs(inputMap);
CorpusReportDTO corpusReportDTO = new CorpusReportDTO();
@@ -184,7 +183,7 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
BusinessTypeEnum.SMART_ASSISTANT.getCode());
} catch (Exception e) {
log.error("runDify 异常", e);
}finally {
} finally {
// 释放许可
semaphore.release();
}
@@ -201,8 +200,8 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
// 获取许可 - 如果没有可用许可会阻塞等待
semaphore.acquire();
// 创建新的DiFyReq对象以避免线程安全问题
inputMap.put("businessId",aicorpusTelephone.getSourceId());
inputMap.put(communicateDateStr,aicorpusTelephone.getTranscribeTime());
inputMap.put("businessId", aicorpusTelephone.getSourceId());
inputMap.put(communicateDateStr, aicorpusTelephone.getTranscribeTime());
inputMap.put("analysisScene", "2");
diFyImageReq.setInputs(inputMap);
@@ -217,7 +216,7 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
aicorpusTelephone.getAiAnalysisRequestId(), BusinessTypeEnum.CORPUS_PORTRAIT_DCC.getCode());
} catch (Exception e) {
log.error("runDify 异常", e);
}finally {
} finally {
// 释放许可
semaphore.release();
}
@@ -227,6 +226,9 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
//第二个业务场景, 结束
}
} catch (Exception e) {
log.error("runTelephoneCorpusDify error:{}", e);
}
}
private void parseDfiyResult(JSONObject execDifyFlow,String recordId,String communicateDate,