| | |
| | | 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; |
| | |
| | | |
| | | @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());//案件描述 |
| | |
| | | } |
| | | } |
| | | } |
| | | 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());//案件描述 |
| | |
| | | lawInfoDtos.add(lawInfoDto); |
| | | } |
| | | } |
| | | GuavaCacheUtils.putCacheAi("get-law"+aiRequestVo.getCaseId(), lawInfoDtos); |
| | | return ReturnSucUtils.getRepInfo("请求成功", lawInfoDtos); |
| | | } |
| | | |
| | |
| | | |
| | | @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());//案件描述 |
| | |
| | | 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); |
| | | } |
| | | |