添加日志,定位是否传 soureId

This commit is contained in:
ZLI263
2025-09-24 17:20:09 +08:00
parent ae5035e5d0
commit 9f1397403f
2 changed files with 26 additions and 21 deletions

View File

@@ -206,7 +206,6 @@ public class TmNameplateCorpusServiceImpl extends ServiceImpl<TmNameplateCorpusM
long endTime = System.currentTimeMillis(); long endTime = System.currentTimeMillis();
log.info("第一个业务场景(总结和分类)执行时间: {} ms", (endTime - startTime)); log.info("第一个业务场景(总结和分类)执行时间: {} ms", (endTime - startTime));
//第一个业务场景, 结束 //第一个业务场景, 结束
long startTime2 = System.currentTimeMillis(); long startTime2 = System.currentTimeMillis();
try { try {
log.info("铭牌语料可用许可授权数,画像场景={}", semaphore.availablePermits()); log.info("铭牌语料可用许可授权数,画像场景={}", semaphore.availablePermits());

View File

@@ -116,13 +116,10 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
RunMaskingRuleInput runMaskingRuleInput = new RunMaskingRuleInput(); RunMaskingRuleInput runMaskingRuleInput = new RunMaskingRuleInput();
runMaskingRuleInput.setDataMaskingRules(maskingRuleItems); runMaskingRuleInput.setDataMaskingRules(maskingRuleItems);
Map<String, Object> inputMap = new HashMap();
DiFyReq diFyImageReq = new DiFyReq();
diFyImageReq.setUser(ConstantStr.corpus_user);
diFyImageReq.setFlowId(telephoneToken);
JSONObject jsonObject = JSONObject.parseObject(aicorpusTelephone.getDisplay()); JSONObject jsonObject = JSONObject.parseObject(aicorpusTelephone.getDisplay());
JSONArray segments = jsonObject.getJSONArray("segments"); JSONArray segments = jsonObject.getJSONArray("segments");
Long audioDuration = jsonObject.getLong("audio_duration"); // 毫秒 Long audioDuration = jsonObject.getLong("audio_duration"); // 毫秒
if (audioDuration / 1000 <= 10) { if (audioDuration / 1000 <= 10) {
log.info("电话语料时长小于10秒不进行dify处理"); log.info("电话语料时长小于10秒不进行dify处理");
return; return;
@@ -157,14 +154,20 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
ZonedDateTime zonedDateTime = ZonedDateTime.parse(jsonObject.getString("start_time")); ZonedDateTime zonedDateTime = ZonedDateTime.parse(jsonObject.getString("start_time"));
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String formattedDateStartTime = zonedDateTime.format(formatter); String formattedDateStartTime = zonedDateTime.format(formatter);
String businessIdSourceId= aicorpusTelephone.getSourceId();
String carModel = getCarModelList(); String carModel = getCarModelList();
inputMap.put("chat", chatList.toString());
inputMap.put("model", carModel); Map<String, Object> inputMapForSummary = new HashMap<>();
inputMap.put("analysisScene", "2"); inputMapForSummary.put("chat", chatList.toString());
inputMap.put("recordId", aicorpusTelephone.getSourceId()); inputMapForSummary.put("model", carModel);
inputMap.put(communicateDateStr, formattedDateStartTime); inputMapForSummary.put("analysisScene", "2");
inputMap.put("version", 2); inputMapForSummary.put("recordId", aicorpusTelephone.getSourceId());
diFyImageReq.setInputs(inputMap); inputMapForSummary.put(communicateDateStr, formattedDateStartTime);
inputMapForSummary.put("version", 2);
Map<String, Object> inputMapForPortrait = new HashMap<>(inputMapForSummary); // 复制一份
inputMapForPortrait.put("businessId", businessIdSourceId); // 仅画像任务需要
CorpusReportDTO corpusReportDTO = new CorpusReportDTO(); CorpusReportDTO corpusReportDTO = new CorpusReportDTO();
corpusReportDTO.setCorpusTime(formattedDateStartTime); corpusReportDTO.setCorpusTime(formattedDateStartTime);
corpusReportDTO.setRecordId(aicorpusTelephone.getSourceId()); corpusReportDTO.setRecordId(aicorpusTelephone.getSourceId());
@@ -175,9 +178,13 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
try { try {
diFyImageReq.setFlowId(telephoneToken); DiFyReq req1 = new DiFyReq();
log.info("dcc语料telephoneToken{}", telephoneToken); req1.setUser(ConstantStr.corpus_user);
JSONObject execDifyFlow = diFyService.executeDifyFlow(diFyImageReq, BusinessTypeEnum.SMART_ASSISTANT.getCode(), req1.setFlowId(telephoneToken);
req1.setInputs(inputMapForSummary);
log.info("dcc语料req1{}", req1);
JSONObject execDifyFlow = diFyService.executeDifyFlow(req1, BusinessTypeEnum.SMART_ASSISTANT.getCode(),
JSONObject.toJSONString(corpusReportDTO), aicorpusTelephone.getAiAnalysisRequestId()); JSONObject.toJSONString(corpusReportDTO), aicorpusTelephone.getAiAnalysisRequestId());
log.info("dcc总结场景,总结和分类 runDify execDifyFlow {}", execDifyFlow); log.info("dcc总结场景,总结和分类 runDify execDifyFlow {}", execDifyFlow);
@@ -194,15 +201,14 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
long startTime2 = System.currentTimeMillis(); long startTime2 = System.currentTimeMillis();
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
try { try {
// 创建新的DiFyReq对象以避免线程安全问题 // 创建新的DiFyReq对象以避免线程安全问题
inputMap.put("businessId", aicorpusTelephone.getSourceId()); DiFyReq req2 = new DiFyReq();
req2.setUser(ConstantStr.corpus_user);
req2.setFlowId(dccTokenPortrait);
req2.setInputs(inputMapForPortrait); // 使用带 businessId 的副本
diFyImageReq.setInputs(inputMap);
diFyImageReq.setFlowId(dccTokenPortrait);
log.info("dcc总结场景,客户画像runDify execDifyFlow {}", dccTokenPortrait); log.info("dcc总结场景,客户画像runDify execDifyFlow {}", dccTokenPortrait);
JSONObject execDifyFlowForPortrait = diFyService.executeDifyFlow(diFyImageReq, BusinessTypeEnum.CORPUS_PORTRAIT_DCC.getCode(), JSONObject execDifyFlowForPortrait = diFyService.executeDifyFlow(req2, BusinessTypeEnum.CORPUS_PORTRAIT_DCC.getCode(),
JSONObject.toJSONString(corpusReportDTO), aicorpusTelephone.getAiAnalysisRequestId()); JSONObject.toJSONString(corpusReportDTO), aicorpusTelephone.getAiAnalysisRequestId());
log.info("dcc客户画像场景 runDify execDifyFlow 返回 , dcc {}", execDifyFlowForPortrait); log.info("dcc客户画像场景 runDify execDifyFlow 返回 , dcc {}", execDifyFlowForPortrait);