From a2a0d4f361068a717e2f86ac3c55d7d48612d3f9 Mon Sep 17 00:00:00 2001
From: xusd <hugeinfo123>
Date: Sun, 08 Sep 2024 10:58:08 +0800
Subject: [PATCH] AI相关接口修正
---
dyh-service/dyh-mediate/src/main/java/cn/huge/module/ai/controller/AiController.java | 31 +++++++++++++++----------------
1 files changed, 15 insertions(+), 16 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 e931965..b5cc753 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
@@ -5,14 +5,13 @@
import cn.huge.module.ai.controller.domain.dto.CaseInfoDetailDto;
import cn.huge.module.ai.controller.domain.dto.CaseInfoDto;
import cn.huge.module.ai.controller.domain.dto.LawInfoDto;
+import cn.huge.module.ai.controller.domain.vo.AiRequestVo;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.openfeign.support.FeignHttpClientProperties;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
@@ -30,13 +29,13 @@
@Value("${ai.url}")
private String aiUrl;
- @RequestMapping("/get-case")
- public Object getCase(@RequestParam String caseDes, @RequestParam String caseClaim, @RequestParam String caseId) {
+ @PostMapping("/get-case")
+ public Object getCase(@RequestBody AiRequestVo aiRequestVo) {
List<CaseInfoDto> caseInfoDtoList = new ArrayList<>();
Map<String, String> params = new HashMap<>();
- params.put("caseDes", caseDes);//案件描述
- params.put("caseClaim", caseClaim);//案件诉求
- params.put("caseId", caseId);//案件id
+ params.put("caseDes", aiRequestVo.getCaseDes());//案件描述
+ params.put("caseClaim", aiRequestVo.getCaseClaim());//案件诉求
+ params.put("caseId", aiRequestVo.getCaseId());//案件id
params.put("topK", "3");
params.put("metricType", "IP");
String s = HttpClientUtils.httpPostForm(aiUrl + "/queryConciliationCase", params, new HashMap<>(), "utf-8");
@@ -75,13 +74,13 @@
}
- @RequestMapping("/get-law")
- public Object getLaw(@RequestParam String caseDes, @RequestParam String caseClaim, @RequestParam String caseId) {
+ @PostMapping("/get-law")
+ public Object getLaw(@RequestBody AiRequestVo aiRequestVo) {
List<LawInfoDto> lawInfoDtos = new ArrayList<>();
Map<String, String> params = new HashMap<>();
- params.put("caseDes", caseDes);//案件描述
- params.put("caseClaim", caseClaim);//案件诉求
- params.put("caseId", caseId);//案件id
+ params.put("caseDes", aiRequestVo.getCaseDes());//案件描述
+ params.put("caseClaim", aiRequestVo.getCaseClaim());//案件诉求
+ params.put("caseId", aiRequestVo.getCaseId());//案件id
String s = HttpClientUtils.httpPostForm(aiUrl + "/queryLawProvision", params, new HashMap<>(), "utf-8");
JSONObject object = JSONObject.parseObject(s);
int code = object.getIntValue("code");
@@ -105,7 +104,7 @@
String s = "";
CaseInfoDetailDto caseInfoDetailDto = new CaseInfoDetailDto();
if (type == 1) {//表示纠纷类案件
- s = HttpClientUtils.httpGet(aiUrl + "/getConciliationCaseText?caseId="+caseId, new HashMap<>(), "utf-8");
+ s = HttpClientUtils.httpGet(aiUrl + "/getConciliationCaseText?caseId=" + caseId, new HashMap<>(), "utf-8");
JSONObject object = JSONObject.parseObject(s);
int code = object.getIntValue("code");
if (code == 200) {
@@ -113,11 +112,11 @@
caseInfoDetailDto.setCaseId(data.getString("id"));
caseInfoDetailDto.setCaseTitle(data.getString("case_title"));
caseInfoDetailDto.setCaseDesc(data.getString("case_des"));
- caseInfoDetailDto.setCaseClaim("case_claim");
+ caseInfoDetailDto.setCaseClaim(data.getString("case_claim"));
caseInfoDetailDto.setAgreeContent(data.getString("agree_content"));
}
} else {
- s = HttpClientUtils.httpGet(aiUrl + "/getJudgmentCaseText?caseId="+caseId, new HashMap<>(), "utf-8");
+ s = HttpClientUtils.httpGet(aiUrl + "/getJudgmentCaseText?caseId=" + caseId, new HashMap<>(), "utf-8");
JSONObject object = JSONObject.parseObject(s);
int code = object.getIntValue("code");
if (code == 200) {
--
Gitblit v1.8.0