异常处理保存
This commit is contained in:
@@ -146,13 +146,33 @@ public class MqMessageRecordServiceImpl extends ServiceImpl<MqMessageRecordMappe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void processDify(DiFyReq diFyReq, JSONArray difyResult, String aiAnalysisRequestId) throws InterruptedException, ExecutionException {
|
private void processDify(DiFyReq diFyReq, JSONArray difyResult, String aiAnalysisRequestId) throws InterruptedException, ExecutionException {
|
||||||
// 并行调用三个workflow
|
|
||||||
//舆情案件分析
|
//舆情案件分析
|
||||||
CompletableFuture<JSONObject> caseWorkFlow = CompletableFuture.supplyAsync(() -> callCommunityWorkFlow(diFyReq,caseToken));
|
CompletableFuture<JSONObject> caseWorkFlow = CompletableFuture.supplyAsync(() -> callCommunityWorkFlow(diFyReq, caseToken))
|
||||||
//内容主题关键词打标
|
.exceptionally(ex -> {
|
||||||
CompletableFuture<JSONObject> keywordWorkFlow = CompletableFuture.supplyAsync(() -> callCommunityWorkFlow(diFyReq,keywordToken));
|
log.error("舆情案件分析失败: {}", ex.getMessage());
|
||||||
//litecrm线索分析
|
JSONObject errorResult = new JSONObject();
|
||||||
CompletableFuture<JSONObject> clueAnalysisWorkFlow = CompletableFuture.supplyAsync(() -> callCommunityWorkFlow(diFyReq,clueAnalysisToken));
|
errorResult.put("error", "舆情案件分析失败: " + ex.getMessage());
|
||||||
|
return errorResult;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 内容主题关键词打标
|
||||||
|
CompletableFuture<JSONObject> keywordWorkFlow = CompletableFuture.supplyAsync(() -> callCommunityWorkFlow(diFyReq, keywordToken))
|
||||||
|
.exceptionally(ex -> {
|
||||||
|
log.error("内容主题关键词打标失败: {}", ex.getMessage());
|
||||||
|
JSONObject errorResult = new JSONObject();
|
||||||
|
errorResult.put("error", "内容主题关键词打标失败: " + ex.getMessage());
|
||||||
|
return errorResult;
|
||||||
|
});
|
||||||
|
|
||||||
|
// litecrm线索分析
|
||||||
|
CompletableFuture<JSONObject> clueAnalysisWorkFlow = CompletableFuture.supplyAsync(() -> callCommunityWorkFlow(diFyReq, clueAnalysisToken))
|
||||||
|
.exceptionally(ex -> {
|
||||||
|
log.error("litecrm线索分析失败: {}", ex.getMessage());
|
||||||
|
JSONObject errorResult = new JSONObject();
|
||||||
|
errorResult.put("error", "litecrm线索分析失败: " + ex.getMessage());
|
||||||
|
return errorResult;
|
||||||
|
});
|
||||||
|
|
||||||
CompletableFuture<Void> allFutures = CompletableFuture.allOf(caseWorkFlow, keywordWorkFlow, clueAnalysisWorkFlow);
|
CompletableFuture<Void> allFutures = CompletableFuture.allOf(caseWorkFlow, keywordWorkFlow, clueAnalysisWorkFlow);
|
||||||
// 等待所有API调用完成
|
// 等待所有API调用完成
|
||||||
allFutures.get();
|
allFutures.get();
|
||||||
|
|||||||
Reference in New Issue
Block a user