From eb13a764afa6bf7c7617c98c7b6b1d898e99acb0 Mon Sep 17 00:00:00 2001 From: zhouxiantao <1026371446@qq.com> Date: Mon, 23 Sep 2024 10:07:15 +0800 Subject: [PATCH] 已办事项-查询条件 --- dyh-service/dyh-mediate/src/main/java/cn/huge/module/ai/controller/AiController.java | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-) diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/ai/controller/AiController.java b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/ai/controller/AiController.java index c15986c..bffe485 100644 --- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/ai/controller/AiController.java +++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/ai/controller/AiController.java @@ -1,6 +1,8 @@ package cn.huge.module.ai.controller; +import cn.huge.base.common.utils.GuavaCacheUtils; import cn.huge.base.common.utils.HttpClientUtils; +import cn.huge.base.common.utils.ObjectUtils; import cn.huge.base.common.utils.ReturnSucUtils; import cn.huge.module.ai.controller.domain.dto.CaseInfoDetailDto; import cn.huge.module.ai.controller.domain.dto.CaseInfoDto; @@ -32,12 +34,16 @@ @PostMapping("/get-case") public Object getCase(@RequestBody AiRequestVo aiRequestVo) { + Object cacheAi = GuavaCacheUtils.getCacheAi("get-case"+aiRequestVo.getCaseId()); + if(ObjectUtils.isNotEmpty(cacheAi)){ + return ReturnSucUtils.getRepInfo("请求成功", cacheAi); + } List<CaseInfoDto> caseInfoDtoList = new ArrayList<>(); Map<String, String> params = new HashMap<>(); params.put("caseDes", aiRequestVo.getCaseDes());//案件描述 params.put("caseClaim", aiRequestVo.getCaseClaim());//案件诉求 params.put("caseId", aiRequestVo.getCaseId());//案件id - params.put("topK", "3"); + params.put("topK", "2"); params.put("metricType", "IP"); String s = HttpClientUtils.httpPostForm(aiUrl + "/queryConciliationCase", params, new HashMap<>(), "utf-8"); JSONObject object = JSONObject.parseObject(s); @@ -53,7 +59,7 @@ caseInfoDtoList.add(caseInfoDto); } } - if (caseInfoDtoList.size() < 6) { + if (caseInfoDtoList.size() < 4) { s = HttpClientUtils.httpPostForm(aiUrl + "/queryJudgmentCase", params, new HashMap<>(), "utf-8"); object = JSONObject.parseObject(s); code = object.getIntValue("code"); @@ -71,12 +77,17 @@ } } } + GuavaCacheUtils.putCacheAi("get-case"+aiRequestVo.getCaseId(), caseInfoDtoList); return ReturnSucUtils.getRepInfo("请求成功", caseInfoDtoList); } @PostMapping("/get-law") public Object getLaw(@RequestBody AiRequestVo aiRequestVo) { + Object cacheAi = GuavaCacheUtils.getCacheAi("get-law"+aiRequestVo.getCaseId()); + if(ObjectUtils.isNotEmpty(cacheAi)){ + return ReturnSucUtils.getRepInfo("请求成功", cacheAi); + } List<LawInfoDto> lawInfoDtos = new ArrayList<>(); Map<String, String> params = new HashMap<>(); params.put("caseDes", aiRequestVo.getCaseDes());//案件描述 @@ -97,6 +108,7 @@ lawInfoDtos.add(lawInfoDto); } } + GuavaCacheUtils.putCacheAi("get-law"+aiRequestVo.getCaseId(), lawInfoDtos); return ReturnSucUtils.getRepInfo("请求成功", lawInfoDtos); } @@ -117,7 +129,7 @@ caseInfoDetailDto.setAgreeContent(data.getString("agree_content")); } } else { - s = HttpClientUtils.httpGet(aiUrl + "/getJudgmentCaseText?caseId=" + caseId, new HashMap<>(), "utf-8"); + s = HttpClientUtils.httpGet(aiUrl + "/getJudgmentCaseText?cpwsCaseInfoId=" + caseId, new HashMap<>(), "utf-8"); JSONObject object = JSONObject.parseObject(s); int code = object.getIntValue("code"); if (code == 200) { @@ -134,6 +146,10 @@ @PostMapping("/get-clain-rise-case") public Object getClaimRiskByCase(@RequestBody AiRequestVo aiRequestVo) { + Object cacheAi = GuavaCacheUtils.getCacheAi("get-clain-rise-case"+aiRequestVo.getCaseId()); + if(ObjectUtils.isNotEmpty(cacheAi)){ + return ReturnSucUtils.getRepInfo("请求成功", cacheAi); + } CaseRiskDto caseRiskDto = new CaseRiskDto(); Map<String, String> params = new HashMap<>(); params.put("caseDes", aiRequestVo.getCaseDes());//案件描述 @@ -147,6 +163,7 @@ caseRiskDto.setIsClaimRisk(data.getIntValue("is_claim_risk")); caseRiskDto.setAnalysisProcess(data.getString("analysis_process")); } + GuavaCacheUtils.putCacheAi("get-clain-rise-case"+aiRequestVo.getCaseId(), caseRiskDto); return ReturnSucUtils.getRepInfo("请求成功", caseRiskDto); } -- Gitblit v1.8.0