diff --git a/src/main/java/com/fkzy/warn/common/util/Demo.java b/src/main/java/com/fkzy/warn/common/util/Demo.java index c6d4404..8e01d9a 100644 --- a/src/main/java/com/fkzy/warn/common/util/Demo.java +++ b/src/main/java/com/fkzy/warn/common/util/Demo.java @@ -28,7 +28,7 @@ public class Demo { // law.queryLimitConsumption(null, null,null,null); // law.monitorQuery(null, null); // law.delcompany(null); - law.queryMonitorCases(null,null,null); +// law.queryMonitorCases(null,null,null); // law.addpublic(null); } diff --git a/src/main/java/com/fkzy/warn/controller/DataCenterController.java b/src/main/java/com/fkzy/warn/controller/DataCenterController.java index c3c32cf..57625bf 100644 --- a/src/main/java/com/fkzy/warn/controller/DataCenterController.java +++ b/src/main/java/com/fkzy/warn/controller/DataCenterController.java @@ -50,7 +50,7 @@ public class DataCenterController { // JSONObject jsonObject = new JSONObject(); // jsonObject.put("creditCode","91410000MA9LPPEA8U"); // lawCaseService.caseStatistics(jsonObject); - alarmCaseService.getAlarmInfo(); +// alarmCaseService.getAlarmInfo(); } catch (Exception e) { log.error("查询错误,errMsg==={}", e.getMessage()); e.printStackTrace(); @@ -64,30 +64,11 @@ public class DataCenterController { public ApiResponse getLawGroup() { ApiResponse apiResponse = new ApiResponse(); try { - LawGroupParam lawGroupParam = new LawGroupParam(); - lawGroupParam.setOrgan("全国人民代表大会"); - lawGroupParam.setExprityDateList(Collections.singletonList("[全国人民代表大会]")); - lawGroupParam.setSourceList(Collections.singletonList("[地方政府规章]")); - lawGroupParam.setTimeliness("现行有效"); - lawGroupParam.setPageSize(20); - lawGroupParam.setPubDate("2014"); - lawGroupParam.setPubDateList(Collections.singletonList("[地方政府规章]")); - lawGroupParam.setTimelinessList(Collections.singletonList("[现行有效]")); - lawGroupParam.setTitle("中国"); - lawGroupParam.setPageNum(1); + // fyApiService.getLawGroup(lawGroupParam); // fyApiService.getLawGroupInfo("9f9d4094-d788-52f6-804d-0fc2a5dd462f"); - AILawParams aiLawParams = new AILawParams(); - aiLawParams.setStream(true); - aiLawParams.setModel("中国法研LLM"); - AImessage aImessage = new AImessage(); - aImessage.setContent("借条和欠条的区别"); - aImessage.setRole("user"); - List aImessageList = new ArrayList<>(); - aImessageList.add(aImessage); - aiLawParams.setMessages(aImessageList); - fyApiService.sendAILaw(aiLawParams); + fyApiService.recommendedCases(null); } catch (Exception e) { log.error("查询错误,errMsg==={}", e.getMessage()); e.printStackTrace(); diff --git a/src/main/java/com/fkzy/warn/model/JudgmentDocument.java b/src/main/java/com/fkzy/warn/model/JudgmentDocument.java new file mode 100644 index 0000000..a361ff9 --- /dev/null +++ b/src/main/java/com/fkzy/warn/model/JudgmentDocument.java @@ -0,0 +1,71 @@ +package com.fkzy.warn.model; + +import lombok.Data; + +/** + * @author zhangjing + * @date 2026/04/01 18:34 + * @description + */ +@Data +public class JudgmentDocument { + /** + * 省份 + */ + private String province; + + /** + * 案件编号 + */ + private String caseid; + + /** + * 法院 + */ + private String court; + + /** + * 审判年份 + */ + private String judgeyear; + + /** + * 文书类型 + */ + private String doctype; + + /** + * 审理程序 + */ + private String procedure; + + /** + * 案由 + */ + private String casecause; + + /** + * 内容片段 + */ + private String chunk; + + /** + * 数据类型 + */ + private String datatype; + + /** + * 高亮列表 + */ + private String highlightList; + + /** + * 唯一标识 + */ + private String uniqid; + + /** + * 段落文本 + */ + private String paragraphText; +} diff --git a/src/main/java/com/fkzy/warn/model/JudgmentDocumentFull.java b/src/main/java/com/fkzy/warn/model/JudgmentDocumentFull.java new file mode 100644 index 0000000..26e5b0f --- /dev/null +++ b/src/main/java/com/fkzy/warn/model/JudgmentDocumentFull.java @@ -0,0 +1,230 @@ +package com.fkzy.warn.model; + +import lombok.Data; +import java.util.List; + +/** + * 裁判文书完整实体类 + */ +@Data +public class JudgmentDocumentFull { + + /** + * 文书唯一编号 + */ + private String uniqid; + + /** + * 案件类型 + */ + private String casetype; + + /** + * 文书类型 + */ + private String doctype; + + /** + * 审理程序 + */ + private String procedure; + + /** + * 法院级别 + */ + private String courtlevel; + + /** + * 引用类型 + */ + private String referencetype; + + /** + * 省份 + */ + private String province; + + /** + * 案由 + */ + private String casecause; + + /** + * 全案由 + */ + private List casecausefull; + + /** + * 裁判年份 + */ + private Integer judgeyear; + + /** + * 引用法律法条 + */ + private List applicableLaw; + + /** + * 引用法律 + */ + private List applicableLawOnly; + + /** + * 案件特征 + */ + private List features; + + /** + * 适用程序 + */ + private List general; + + /** + * 段落信息 + */ + private List formatParagraphs; + + // 内部类 - 段落格式 + @Data + public static class FormatParagraph { + /** + * 标题 + */ + private String title; + + /** + * 文书首部 + */ + private HeadInfo headInfo; + + /** + * 当事人 + */ + private String litigants; + + /** + * 其他诉讼参与人 + */ + private OtherParticipants otherParticipants; + + /** + * 审理经过 + */ + private String trialProcess; + + /** + * 前审经过 + */ + private String preTrialProcess; + + /** + * 诉辩意见 + */ + private Pleadings pleadings; + + /** + * 法庭辩论 + */ + private String argumentsCourt; + + /** + * 裁判结果 + */ + private JudgeResult judgeResult; + + /** + * 文书尾部 + */ + private TailInfo tailInfo; + } + + // 内部类 - 文书首部 + @Data + public static class HeadInfo { + /** + * 审理法院 + */ + private String court; + + /** + * 文书类型 + */ + private String doctype; + + /** + * 案号 + */ + private String caseid; + } + + // 内部类 - 其他诉讼参与人 + @Data + public static class OtherParticipants { + /** + * 律师 + */ + private String lawyer; + } + + // 内部类 - 诉辩意见 + @Data + public static class Pleadings { + /** + * 公诉机关称 + */ + private String prosecutionWords; + + /** + * 第三人称 + */ + private String thirdPersonWords; + + /** + * 辩称 + */ + private String arguedWords; + + /** + * 诉称 + */ + private String claimsWords; + } + + // 内部类 - 裁判结果 + @Data + public static class JudgeResult { + /** + * 本院查明 + */ + private String courtAscertainedWords; + + /** + * 本院认为 + */ + private String courtBelieveWords; + + /** + * 裁判结果 + */ + private String judgeResultWords; + } + + // 内部类 - 文书尾部 + @Data + public static class TailInfo { + /** + * 审判人员 + */ + private String judgeMembers; + + /** + * 日期(裁判日期) + */ + private String judgeDate; + + /** + * 书记员 + */ + private String clerk; + } +} \ No newline at end of file diff --git a/src/main/java/com/fkzy/warn/model/params/JudgmentSearchParams.java b/src/main/java/com/fkzy/warn/model/params/JudgmentSearchParams.java new file mode 100644 index 0000000..8545f0f --- /dev/null +++ b/src/main/java/com/fkzy/warn/model/params/JudgmentSearchParams.java @@ -0,0 +1,219 @@ +package com.fkzy.warn.model.params; + + +import lombok.Data; +import java.util.List; + +/** + * @author zhangjing + * @date 2026/04/01 19:15 + * @description + * + * 裁判文书搜索请求实体类 + */ +@Data +public class JudgmentSearchParams { + + /** + * 基础属性 + */ + private BasicCondition basicCondition; + + /** + * 案情要素 + */ + private CaseInfo caseInfo; + + /** + * 每页条数,默认10 + */ + private Integer pageSize = 10; + + /** + * 页码,默认1 + */ + private Integer pageNum = 1; + + /** + * 排序字段 + */ + private List sort; + + // 内部类 - 基础属性 + @Data + public static class BasicCondition { + /** + * 案由 + */ + private List casecause; + + /** + * 案件类型 + */ + private List casetype; + + /** + * 法院 + */ + private List court; + + /** + * 法院级别 + */ + private List courtLevel; + + /** + * 裁判年份 + */ + private List judgeYear; + + /** + * 文书类型 + */ + private List doctype; + + /** + * 省份 + */ + private List province; + + /** + * 结束裁判年份 + */ + private String endJudgeYear; + + /** + * 开始裁判年份 + */ + private String startJudgeYear; + + /** + * 审理程序 + */ + private List procedure; + } + + // 内部类 - 案情要素 + @Data + public static class CaseInfo { + /** + * 标题 + */ + private List title; + + /** + * 案号 + */ + private List caseid; + + /** + * 当事人 + */ + private List enterprises; + + /** + * 全文 + */ + private List content; + + /** + * 裁判理由 + */ + private List judgmentReason; + + /** + * 裁判结果 + */ + private List judgmentResult; + + /** + * 诉辩意见 + */ + private List pleadingOpinion; + + /** + * 争议焦点 + */ + private List focus; + + /** + * 案情特征 + */ + private List features; + + /** + * 法条依据 + */ + private List applicableLaw; + + /** + * 自然人 + */ + private List naturalper; + + /** + * 律所 + */ + private List lawfirms; + + /** + * 律师 + */ + private List lawyer; + + /** + * 企业类型 + */ + private List category; + + /** + * 金融标签 + */ + private List financeLabel; + + /** + * 机构类型 + */ + private List orgTypes; + + /** + * 机构子类型 + */ + private List orgSubtypes; + + /** + * 企业规模 + */ + private List standardcategory; + + /** + * 岗位 + */ + private List post; + + /** + * 诉讼地位 + */ + private List lawrole; + + /** + * 企业名称 + */ + private List companyname; + + /** + * 工作单位岗位层级 + */ + private List professionLevel; + + /** + * 工作单位机构类型 + */ + private List wuOrgSubtype; + + /** + * 工作单位机构大类 + */ + private List wuOrgType; + } +} diff --git a/src/main/java/com/fkzy/warn/model/params/RecommendedCasesParams.java b/src/main/java/com/fkzy/warn/model/params/RecommendedCasesParams.java new file mode 100644 index 0000000..76b2fc2 --- /dev/null +++ b/src/main/java/com/fkzy/warn/model/params/RecommendedCasesParams.java @@ -0,0 +1,64 @@ +package com.fkzy.warn.model.params; + +import lombok.Data; + +import java.util.List; + +/** + * @author zhangjing + * @date 2026/04/01 18:26 + * @description + */ +@Data +public class RecommendedCasesParams { + /** 文书类型 ["判决书"] */ + private List doctype; + + /** 查询关键词 酒后驾驶 */ + private String question; + + /** 省份 ["山东省"] */ + private List province; + + /** 城市 ["济南市"] */ + private List city; + + /** 案由 [] */ + private List casecause; + + /** 返回结果数量 10 */ + private String top_k; + + /** 案件类型 ["民事"] */ + private List casetype; + + /** 法院名称 ["济南市历城区人民法院"] */ + private List court; + + /** 审判年份 ["2023"] */ + private List judgeyear; + + /** 版本 v1 */ + private List version; + + /** 关键词信息 包含案情关键词等 */ + private List info_key; + + /** 法院层级 ["基层法院"] */ + private List courtlevel; + + public static class InfoKey { + + /** 案情关键词 包含模糊关键词和主句相关关键词 */ + private List case_words; + + public static class CaseWords { + + /** 词语模糊关键词 ["酒后驾驶"] */ + private List czmgjc; + + /** 主句相关关键词 ["酒后驾驶"] */ + private List zjxgjc; + } + } +} diff --git a/src/main/java/com/fkzy/warn/service/FyApiService.java b/src/main/java/com/fkzy/warn/service/FyApiService.java index b66788a..dadbeba 100644 --- a/src/main/java/com/fkzy/warn/service/FyApiService.java +++ b/src/main/java/com/fkzy/warn/service/FyApiService.java @@ -3,7 +3,9 @@ package com.fkzy.warn.service; import com.baomidou.mybatisplus.extension.service.IService; import com.fkzy.warn.model.LawCase; import com.fkzy.warn.model.params.AILawParams; +import com.fkzy.warn.model.params.JudgmentSearchParams; import com.fkzy.warn.model.params.LawGroupParam; +import com.fkzy.warn.model.params.RecommendedCasesParams; import java.util.List; @@ -15,9 +17,58 @@ import java.util.List; public interface FyApiService extends IService { void getAccessToken(); + /** + * 法规分组 + * + * @param lawGroupParam + * @return void + * @create 2026/4/1 + **/ void getLawGroup(LawGroupParam lawGroupParam); + /** + * 法规详情 + * + * @param id + * @return void + * @create 2026/4/1 + **/ void getLawGroupInfo(String id); - + /** + * AI对话 + * + * @param aiLawParams + * @return void + * @create 2026/4/1 + **/ void sendAILaw(AILawParams aiLawParams); + + /** + * 相似案例推荐 + * + * @param recommendedCasesParams + * @return void + * @create 2026/4/1 + **/ + void recommendedCases(RecommendedCasesParams recommendedCasesParams); + + /** + * 文书唯一标识 + * + * @param docId + * @return void + * @create 2026/4/1 + **/ + void caseById(String docId); + + /** + * 公开案例高级检索 + * + * @param judgmentSearchParams + * @return void + * @create 2026/4/1 + **/ + void caseAdvanced(JudgmentSearchParams judgmentSearchParams); + + } diff --git a/src/main/java/com/fkzy/warn/service/impl/AlarmCaseServiceImpl.java b/src/main/java/com/fkzy/warn/service/impl/AlarmCaseServiceImpl.java index 5ae1eee..0d1250d 100644 --- a/src/main/java/com/fkzy/warn/service/impl/AlarmCaseServiceImpl.java +++ b/src/main/java/com/fkzy/warn/service/impl/AlarmCaseServiceImpl.java @@ -97,10 +97,12 @@ public class AlarmCaseServiceImpl extends ServiceImpl { - InvocationRecord lawResult = LawResearchUtil.querySxx(item.getCompanyName(), item.getCreditCode(), null); - invocationRecordService.saveModel(result); - JSONObject resultObj = JSONObject.parseObject(lawResult.getApiResult()); - lawCaseService.judicialModelSave(resultObj); + if(item.getCompanyName()!=null){ + InvocationRecord lawResult = LawResearchUtil.querySxx(item.getCompanyName(), item.getCreditCode(), null); + invocationRecordService.saveModel(result); + JSONObject resultObj = JSONObject.parseObject(lawResult.getApiResult()); + lawCaseService.judicialModelSave(resultObj); + } }); diff --git a/src/main/java/com/fkzy/warn/service/impl/FyApiServiceImpl.java b/src/main/java/com/fkzy/warn/service/impl/FyApiServiceImpl.java index 617d3cb..31f41f7 100644 --- a/src/main/java/com/fkzy/warn/service/impl/FyApiServiceImpl.java +++ b/src/main/java/com/fkzy/warn/service/impl/FyApiServiceImpl.java @@ -10,9 +10,7 @@ import com.fkzy.warn.common.util.MD5Util; import com.fkzy.warn.common.util.RedisUtil; import com.fkzy.warn.mapper.LawCaseMapper; import com.fkzy.warn.model.*; -import com.fkzy.warn.model.params.AILawParams; -import com.fkzy.warn.model.params.LawGroupParam; -import com.fkzy.warn.model.params.PageParam; +import com.fkzy.warn.model.params.*; import com.fkzy.warn.service.FyApiService; import com.fkzy.warn.service.InvocationRecordService; import lombok.extern.slf4j.Slf4j; @@ -36,7 +34,7 @@ import javax.annotation.Resource; import java.io.IOException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; -import java.util.UUID; +import java.util.*; import java.util.concurrent.TimeUnit; /** @@ -67,6 +65,16 @@ public class FyApiServiceImpl extends ServiceImpl implem @Value(value = "${api.apiId}") private String apiId; + + @Value(value = "${api.recommendedCasesUrl}") + private String recommendedCasesUrl; + + @Value(value = "${api.caseByIdUrl}") + private String caseByIdUrl; + + @Value(value = "${api.caseAdvancedUrl}") + private String caseAdvancedUrl; + @Resource RedisUtil redisUtil; @Resource @@ -94,11 +102,18 @@ public class FyApiServiceImpl extends ServiceImpl implem @Override public void getLawGroup(LawGroupParam lawGroupParam) { -// getAccessToken(); -// if (true){ -// return; -// } +// LawGroupParam lawGroupParam = new LawGroupParam(); +// lawGroupParam.setOrgan("全国人民代表大会"); +// lawGroupParam.setExprityDateList(Collections.singletonList("[全国人民代表大会]")); +// lawGroupParam.setSourceList(Collections.singletonList("[地方政府规章]")); +// lawGroupParam.setTimeliness("现行有效"); +// lawGroupParam.setPageSize(20); +// lawGroupParam.setPubDate("2014"); +// lawGroupParam.setPubDateList(Collections.singletonList("[地方政府规章]")); +// lawGroupParam.setTimelinessList(Collections.singletonList("[现行有效]")); +// lawGroupParam.setTitle("中国"); +// lawGroupParam.setPageNum(1); PageParam pageParam = new PageParam(); pageParam.setPageNum(1); pageParam.setPageSize(20); @@ -128,14 +143,73 @@ public class FyApiServiceImpl extends ServiceImpl implem @Override public void sendAILaw(AILawParams aiLawParams) { -// getAccessToken(); -// if (true) { -// return; -// } +// AILawParams aiLawParams = new AILawParams(); +// aiLawParams.setStream(true); +// aiLawParams.setModel("中国法研LLM"); +// AImessage aImessage = new AImessage(); +// aImessage.setContent("借条和欠条的区别"); +// aImessage.setRole("user"); +// List aImessageList = new ArrayList<>(); +// aImessageList.add(aImessage); +// aiLawParams.setMessages(aImessageList); + String jsonParams = JSON.toJSONString(aiLawParams); HttpHeaders headers = getRequestHeader(jsonParams); postStream(aiLawUrl, headers, jsonParams, "法研平台-AI检索法规"); + + } + + @Override + public void recommendedCases(RecommendedCasesParams recommendedCasesParams) { + if (recommendedCasesParams==null){ + recommendedCasesParams = new RecommendedCasesParams(); + } +// recommendedCasesParams.setCity(Arrays.asList("[\"山东省\"]")); +// recommendedCasesParams.setProvince(Arrays.asList("[\"济南市\"]")); +// recommendedCasesParams.setDoctype(Arrays.asList("[\"判决书\"]")); + recommendedCasesParams.setQuestion("酒后驾驶"); + recommendedCasesParams.setTop_k("10"); + + String jsonParams = JSON.toJSONString(recommendedCasesParams); + HttpHeaders headers = getRequestHeader(jsonParams); + String result = postAip(recommendedCasesUrl, headers, jsonParams, "相似案例推荐"); + ApiResult> resultData = JSON.parseObject( + result, + new TypeReference>>() { + } + ); + } + + @Override + public void caseById(String docId) { + + JSONObject object = new JSONObject(); + object.put("id", docId); + String json = object.toJSONString(); + HttpHeaders headers = getRequestHeader(json); + String result = postAip(caseByIdUrl, headers, json, "法研平台-按文书标识查询公开案例详情"); + ApiResult resultData = JSON.parseObject( + result, + new TypeReference>() { + } + ); } + + @Override + public void caseAdvanced(JudgmentSearchParams judgmentSearchParams) { + if (judgmentSearchParams ==null){ + judgmentSearchParams = new JudgmentSearchParams(); + } + String jsonParams = JSON.toJSONString(judgmentSearchParams); + HttpHeaders headers = getRequestHeader(jsonParams); + String result = postAip(caseAdvancedUrl, headers, jsonParams, "公开案例高级检索"); + ApiResult> resultData = JSON.parseObject( + result, + new TypeReference>>() { + } + ); + } + /** * 发送流式请求到指定URL,并处理SSE响应 * diff --git a/src/main/resources/bootstrap-dev.yml b/src/main/resources/bootstrap-dev.yml index d26431d..f82f1b4 100644 --- a/src/main/resources/bootstrap-dev.yml +++ b/src/main/resources/bootstrap-dev.yml @@ -70,6 +70,13 @@ api: lawGroupInfoUrl: https://api.cjbdi.com:8443/354347/kaas/web/law/getLawStripRelateResultById aiLawUrl: https://api.cjbdi.com:8443/354347/defg/web/openapis/template/flux/38 apiId: ea255f4a400342b5b96c8fb904616354 + #相似案例推荐 + recommendedCasesUrl: https://api.cjbdi.com:8443/354347/llm/dmxla/simliar/case/es + #按文书标识查询公开案例详情 + caseByIdUrl: https://api.cjbdi.com:8443/354347/leian/des/common/detail + #公开案例高级检索 + caseAdvancedUrl: https://api.cjbdi.com:8443/354347/leian/des/common/list + diff --git a/src/main/resources/bootstrap.yml b/src/main/resources/bootstrap.yml index f5802f7..ee15cd1 100644 --- a/src/main/resources/bootstrap.yml +++ b/src/main/resources/bootstrap.yml @@ -26,7 +26,7 @@ spring: maxFileSize: 200MB maxRequestSize: 200MB profiles: - active: prod + active: dev application: name: fxzy_warn