cc 2 meses atrás
pai
commit
d4876cf63d

+ 0 - 13
ai-server/src/main/java/com/zsjz/ai/module/agent/tools/AgentToolRegistry.java

@@ -171,11 +171,6 @@ public class AgentToolRegistry {
     private final TrackMeetService trackMeetService;
     private final TrackTogetherLiveService trackTogetherLiveService;
     private final TrackTogetherTravelService trackTogetherTravelService;
-
-    private final SearchService searchService;
-    private final SpecialDateService specialDateService;
-    private final TimeSeriesService timeSeriesService;
-
     private final GraphService graphService;
 
     private final DataProfileService dataProfileService;
@@ -205,9 +200,6 @@ public class AgentToolRegistry {
                              TrackMeetService trackMeetService,
                              TrackTogetherLiveService trackTogetherLiveService,
                              TrackTogetherTravelService trackTogetherTravelService,
-                             SearchService searchService,
-                             SpecialDateService specialDateService,
-                             TimeSeriesService timeSeriesService,
                              GraphService graphService,
                              DataProfileService dataProfileService,
                              IntimacyService intimacyService,
@@ -235,9 +227,6 @@ public class AgentToolRegistry {
         this.trackMeetService = trackMeetService;
         this.trackTogetherLiveService = trackTogetherLiveService;
         this.trackTogetherTravelService = trackTogetherTravelService;
-        this.searchService = searchService;
-        this.specialDateService = specialDateService;
-        this.timeSeriesService = timeSeriesService;
         this.graphService = graphService;
         this.dataProfileService = dataProfileService;
         this.intimacyService = intimacyService;
@@ -265,8 +254,6 @@ public class AgentToolRegistry {
         toolkit.registerTool(new TrackAnalysisTool(trackCellTowerService, trackEnLocalService,
                 trackExpressInfoService, trackMeetService, trackTogetherLiveService,
                 trackTogetherTravelService, sqlResultStore));
-        toolkit.registerTool(new OtgAnalysisTool(searchService, specialDateService,
-                timeSeriesService, sqlResultStore));
         toolkit.registerTool(new GraphAnalysisTool(graphService, sqlResultStore));
         toolkit.registerTool(new PersonAnalysisTool(dataProfileService, intimacyService,
                 personBasicInfoService, personGroupService, sqlResultStore));

+ 9 - 9
ai-server/src/main/java/com/zsjz/ai/module/agent/tools/CallToolSpecs.java

@@ -94,7 +94,7 @@ public final class CallToolSpecs {
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500(用户可在前端表格翻页看全部)",
                    required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -133,20 +133,20 @@ public final class CallToolSpecs {
         /** 连续月份阈值 */
         @ToolParam(name = "monthVal", description = "连续月份阈值:只统计有夜间通话的月份数 ≥ 该值的对象,默认 2",
                    required = false)
-        public Number monthVal;
+        public Integer monthVal;
 
         /** 夜间起始小时 */
         @ToolParam(name = "nightStart", description = "夜间时段起始小时(0-23),默认 18", required = false)
-        public Number nightStart;
+        public Integer nightStart;
 
         /** 夜间结束小时 */
         @ToolParam(name = "nightEnd", description = "夜间时段结束小时(0-23),默认 6;小于起始小时表示跨零点(如 18 到次日 6)",
                    required = false)
-        public Number nightEnd;
+        public Integer nightEnd;
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -184,11 +184,11 @@ public final class CallToolSpecs {
 
         /** 连续月份阈值 */
         @ToolParam(name = "monthVal", description = "连续月份阈值:只统计连续通话月数 ≥ 该值的对象,默认 2", required = false)
-        public Number monthVal;
+        public Integer monthVal;
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -218,7 +218,7 @@ public final class CallToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -251,6 +251,6 @@ public final class CallToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 }

+ 8 - 78
ai-server/src/main/java/com/zsjz/ai/module/agent/tools/GraphAnalysisTool.java

@@ -12,6 +12,7 @@ import com.zsjz.ai.common.model.graph.query.GraphCallDetailQuery;
 import com.zsjz.ai.common.model.graph.query.GraphQuery;
 import com.zsjz.ai.common.model.graph.query.GraphTransDetailQuery;
 import com.zsjz.ai.common.model.trans.entity.TransRecord;
+import com.zsjz.ai.common.utils.DataUtil;
 import com.zsjz.ai.common.utils.Json;
 import com.zsjz.ai.module.agent.sql.SqlResultStore;
 import com.zsjz.ai.module.graph.service.GraphService;
@@ -141,22 +142,15 @@ public class GraphAnalysisTool {
             if (personNames == null) {
                 return ToolResults.error("personNames 必传(至少一个本方姓名),图谱以这些人为核心节点向外扩展");
             }
-            // 预检人员库:GraphService#graph 内部直接对 CaseDataCache 的结果调 forEach,
-            // 人员名写错(或案件未打开)时会抛 NPE,核心节点为空还会让 DuckDB 的 unnest([]) 报错
-            if (!hasPersonLibData(personNames, needCard, needCall)) {
-                return ToolResults.error("未查到人员 " + personNames
-                        + " 的卡号/号码信息,请确认姓名正确且已在客户端打开案件后重试");
-            }
-
             GraphQuery q = new GraphQuery();
             q.setType(types);
             q.setPersonNames(personNames);
             q.setStartDate(parseDate(spec.startDate, "startDate"));
             q.setEndDate(parseDate(spec.endDate, "endDate"));
             // 金额/次数会被服务端直接拼进 SQL,必须转成纯数字字符串(见 GraphToolSpecs 注释)
-            q.setStartMoney(plainNumber(spec.startMoney));
-            q.setEndMoney(plainNumber(spec.endMoney));
-            q.setCallNum(spec.callNum == null ? null : String.valueOf(spec.callNum.intValue()));
+            q.setStartMoney(DataUtil.convertAmount(spec.startMoney));
+            q.setEndMoney(DataUtil.convertAmount(spec.endMoney));
+            q.setCallNum(spec.callNum == null ? null : String.valueOf(spec.callNum));
 
             Map<String, Object> result = graphService.graph(q);
             return ToolResults.ok(Json.toStr(trimGraphResult(result)));
@@ -255,7 +249,7 @@ public class GraphAnalysisTool {
             if (spec.transAmount != null) {
                 // 比较符与金额缺一不可:XML 里是 `${p.transAmountSymbol} #{p.transAmount}`,
                 // 只给金额会拼出 `transAmount  1000` 这种非法 SQL
-                q.setTransAmount(toBigDecimal(spec.transAmount));
+                q.setTransAmount(spec.transAmount);
                 q.setTransAmountSymbol(symbolOrDefault(spec.transAmountSymbol, SymbolEnum.GE));
             }
             q.setStartDate(parseDate(spec.startDate, "startDate"));
@@ -335,7 +329,7 @@ public class GraphAnalysisTool {
             q.setNode(node);
             if (spec.transAmount != null) {
                 // 服务端用 getTransAmountSymbol() 取符号并拼进 SQL,比较符必须走白名单
-                q.setTransAmount(plainNumber(spec.transAmount));
+                q.setTransAmount(DataUtil.convertAmount(spec.transAmount));
                 q.setTransAmountSymbol(symbolOrDefault(spec.transAmountSymbol, SymbolEnum.EQ));
             }
             q.setStartDate(parseDate(spec.startDate, "startDate"));
@@ -350,26 +344,6 @@ public class GraphAnalysisTool {
         }
     }
 
-    /**
-     * 已保存的图谱历史列表
-     */
-    @Tool(name = "list_graph_history",
-          description = "查询已保存的关系图谱历史列表(用户在图谱页保存的快照),返回可翻页表格,"
-                  + "每行包含 id(历史ID)、graphName(图谱名称)、path(服务端快照文件路径)。"
-                  + "★ 用户问「之前保存过哪些图谱」「图谱历史记录」时用本工具;"
-                  + "要读取某条历史的具体图谱内容,用 get_graph_history_content 并传入该行的 id。",
-          readOnly = true)
-    public ToolResultBlock listGraphHistory(
-            @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-            Number pageSize) {
-        try {
-            List<GraphHis> list = graphService.graphHis();
-            return ToolResultTable.store(sqlResultStore, null, list, 1,
-                    ToolResultTable.normalizePageSize(pageSize));
-        } catch (Exception e) {
-            return fail("关系图谱历史列表查询", e);
-        }
-    }
 
     /**
      * 读取图谱历史内容
@@ -380,12 +354,12 @@ public class GraphAnalysisTool {
                   + "返回的 JSON 是保存图谱时前端存下的节点/连线数据,可直接据此复述或再喂给 render_graph 重新渲染。",
           readOnly = true)
     public ToolResultBlock getGraphHistoryContent(
-            @ToolParam(name = "id", description = "关系图谱历史ID,取自 list_graph_history 返回的 id") Number id) {
+            @ToolParam(name = "id", description = "关系图谱历史ID,取自 list_graph_history 返回的 id") Long id) {
         try {
             if (id == null) {
                 return ToolResults.error("图谱历史不存在或内容为空: id=null");
             }
-            String content = graphService.readGraphHisContent(id.longValue());
+            String content = graphService.readGraphHisContent(id);
             if (content == null || content.trim().isEmpty()) {
                 return ToolResults.error("图谱历史不存在或内容为空: id=" + id);
             }
@@ -446,50 +420,6 @@ public class GraphAnalysisTool {
         }
     }
 
-    /**
-     * 人员库预检:判断这些姓名在当前案件里能否取到卡号/号码。
-     *
-     * <p>为什么需要:{@code GraphService#graph} 内部直接对 {@link CaseDataCache} 的返回结果调 forEach,
-     * 未命中时返回 null 会抛 NPE;且核心节点为空时 DuckDB 的 {@code unnest([])} 也会报错。
-     * 提前拦下并给出「姓名写错 / 未开案」的可读提示,比把 NPE 抛给模型好。
-     */
-    private static boolean hasPersonLibData(List<String> personNames, boolean needCard, boolean needCall) {
-        for (String name : personNames) {
-            if (needCard && CaseDataCache.getPerCards(name) != null) {
-                return true;
-            }
-            if (needCall && CaseDataCache.getPerPhones(name) != null) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * 金额/次数转「纯数字字符串」:这些值会被服务端直接拼进 SQL,必须是数字形态。
-     *
-     * <p>走 {@link BigDecimal#toPlainString()} 是为了避开 {@code Double.toString} 的科学计数法
-     * (如 {@code 1.0E7}),那种形态拼进 SQL 未必能解析。
-     */
-    private static String plainNumber(Number value) {
-        if (value == null) {
-            return null;
-        }
-        try {
-            return new BigDecimal(value.toString()).toPlainString();
-        } catch (NumberFormatException e) {
-            throw new IllegalArgumentException("金额/次数格式不合法(应为数字):" + value);
-        }
-    }
-
-    /**
-     * 金额转 BigDecimal({@link GraphTransDetailQuery#setTransAmount(BigDecimal)} 用)
-     */
-    private static BigDecimal toBigDecimal(Number value) {
-        String text = plainNumber(value);
-        return text == null ? null : new BigDecimal(text);
-    }
-
     /**
      * 金额比较符白名单归一化。
      *

+ 2 - 2
ai-server/src/main/java/com/zsjz/ai/module/agent/tools/GraphSpec.java

@@ -72,7 +72,7 @@ public class GraphSpec {
 
         /** 度数或权重 */
         @ToolParam(name = "value", description = "节点权重/度数(数字,整数或小数)", required = false)
-        public Number value;
+        public Integer value;
 
         /** 节点说明 */
         @ToolParam(name = "desc", description = "节点补充说明(身份证号、角色等)", required = false)
@@ -114,7 +114,7 @@ public class GraphSpec {
         /** 关系权重 */
         @ToolParam(name = "value", description = "关系权重(数字,整数或小数),如通话次数、转账笔数、转账金额",
                    required = false)
-        public Number value;
+        public Integer value;
     }
 
     /** 分类 */

+ 9 - 8
ai-server/src/main/java/com/zsjz/ai/module/agent/tools/GraphToolSpecs.java

@@ -3,6 +3,7 @@ package com.zsjz.ai.module.agent.tools;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import io.agentscope.core.tool.ToolParam;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -73,18 +74,18 @@ public final class GraphToolSpecs {
         @ToolParam(name = "startMoney",
                    description = "交易金额下限(按边聚合后的金额,如 50000);仅 type 含 101/102/103 时生效",
                    required = false)
-        public Number startMoney;
+        public BigDecimal startMoney;
 
         /** 交易金额上限 */
         @ToolParam(name = "endMoney",
                    description = "交易金额上限;仅 type 含 101/102/103 时生效", required = false)
-        public Number endMoney;
+        public BigDecimal endMoney;
 
         /** 通话次数下限 */
         @ToolParam(name = "callNum",
                    description = "通话次数下限,只保留通话次数 ≥ 该值的通话边(如 3);仅 type 含 201/202/203 时生效",
                    required = false)
-        public Number callNum;
+        public Integer callNum;
     }
 
     /**
@@ -129,7 +130,7 @@ public final class GraphToolSpecs {
         @ToolParam(name = "transAmount",
                    description = "单笔交易金额阈值,配合 transAmountSymbol 使用(如 50000 表示金额 ≥ 5 万)",
                    required = false)
-        public Number transAmount;
+        public BigDecimal transAmount;
 
         /** 金额比较符 */
         @ToolParam(name = "transAmountSymbol",
@@ -148,7 +149,7 @@ public final class GraphToolSpecs {
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500(用户可在前端表格翻页看全部)",
                    required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -181,7 +182,7 @@ public final class GraphToolSpecs {
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500(用户可在前端表格翻页看全部)",
                    required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -208,7 +209,7 @@ public final class GraphToolSpecs {
         /** 交易金额阈值(仅 card 节点) */
         @ToolParam(name = "transAmount",
                    description = "交易金额阈值(仅 clazz=card 有效),配合 transAmountSymbol 使用", required = false)
-        public Number transAmount;
+        public BigDecimal transAmount;
 
         /** 金额比较符 */
         @ToolParam(name = "transAmountSymbol",
@@ -230,6 +231,6 @@ public final class GraphToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的明细行数上限,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 }

+ 0 - 428
ai-server/src/main/java/com/zsjz/ai/module/agent/tools/OtgAnalysisTool.java

@@ -1,428 +0,0 @@
-package com.zsjz.ai.module.agent.tools;
-
-import com.zsjz.ai.common.base.Query;
-import com.zsjz.ai.common.enums.SymbolEnum;
-import com.zsjz.ai.common.enums.TimeSeriesTypeEnum;
-import com.zsjz.ai.common.model.otg.dto.SearchDTO;
-import com.zsjz.ai.common.model.otg.entity.SpecialDateRecord;
-import com.zsjz.ai.common.model.otg.entity.TimeSeries;
-import com.zsjz.ai.common.model.otg.query.TimeSeriesQuery;
-import com.zsjz.ai.common.utils.Json;
-import com.zsjz.ai.module.agent.sql.SqlResultStore;
-import com.zsjz.ai.module.otg.service.SearchService;
-import com.zsjz.ai.module.otg.service.SpecialDateService;
-import com.zsjz.ai.module.otg.service.TimeSeriesService;
-import io.agentscope.core.message.ToolResultBlock;
-import io.agentscope.core.tool.Tool;
-import io.agentscope.core.tool.ToolParam;
-import lombok.extern.slf4j.Slf4j;
-
-import java.time.LocalDate;
-import java.time.format.DateTimeParseException;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * 行为时空 / 全文检索类 Agent 工具集(5 个工具),把 {@code module/otg} 下既有的<b>只读</b>业务方法
- * 暴露给 Agent。
- *
- * <p><b>设计要点:</b>
- * <ul>
- *   <li><b>只做适配,不重写业务</b>:全部取数仍走 {@link SearchService} /
- *       {@link SpecialDateService} / {@link TimeSeriesService},与前端 HTTP 接口用的是同一套
- *       SQL 与同一套口径(例如时间轴 SQL 内置的 {@code limit 20}、跳转的 rowid ±10)。
- *       这样「页面上看到的」与「AI 说的」不会打架。</li>
- *   <li><b>写操作一律不封装</b>:{@code SpecialDateService} 的 {@code create} / {@code update} /
- *       {@code delete} 会改数据,明确排除在本工具集之外。</li>
- *   <li><b>返回形态复用 resultId 分页契约</b>:结果写入 {@link SqlResultStore} 后返回
- *       {@code {resultId, columns, rows, page, pageSize, totalRows, totalPages}},
- *       与 {@code execute_sql} 完全一致,前端 {@code DataTableBlock} 直接渲染可翻页表格。</li>
- *   <li><b>入参是专用 POJO</b>({@link OtgToolSpecs}):不把 {@code Query} 基类的
- *       {@code orderKey}/{@code sort}/{@code tableName} 暴露给模型,避免 ORDER BY 拼接注入面。</li>
- *   <li>工具是普通类(非 Spring Bean),由 {@code AgentService#buildAgent} 手工 new 出来注册,
- *       与 {@link CallAnalysisTool} 一致。</li>
- * </ul>
- *
- * <p>数据源:{@link TimeSeriesService} / {@link SpecialDateService} 底下的 mapper 标了
- * {@code @DS("slave")}(当前案件的 DuckDB),与 {@code execute_sql} 同库;{@link SearchService}
- * 走的是案件级 Lucene 索引,无需额外处理。
- */
-@Slf4j
-public class OtgAnalysisTool {
-
-    /**
-     * 单次取数行数上限。
-     *
-     * <p>与 {@code execute_sql} 的 100000 行硬上限不同,这里刻意压到 1 万:
-     * {@link SqlResultStore} 是 LRU 50 条 / TTL 30 分钟的<b>进程级共享</b>缓存,
-     * 明细动辄上万行,放太宽会把 {@code execute_sql} 的结果挤掉。
-     * 超限时返回可读报错让模型收窄条件,而不是悄悄截断(截断会让模型得出错误结论)。
-     */
-    private static final int FETCH_LIMIT = 10_000;
-
-    private final SearchService searchService;
-    private final SpecialDateService specialDateService;
-    private final TimeSeriesService timeSeriesService;
-    private final SqlResultStore sqlResultStore;
-
-    public OtgAnalysisTool(SearchService searchService,
-                           SpecialDateService specialDateService,
-                           TimeSeriesService timeSeriesService,
-                           SqlResultStore sqlResultStore) {
-        this.searchService = searchService;
-        this.specialDateService = specialDateService;
-        this.timeSeriesService = timeSeriesService;
-        this.sqlResultStore = sqlResultStore;
-    }
-
-    // ==================== 工具定义 ====================
-
-    /**
-     * 案件材料全文检索
-     */
-    @Tool(name = "search_global",
-          description = "对当前案件已建立的全文索引做关键词检索(Lucene 通配模糊匹配),"
-                  + "用于回答「这个关键词出现在哪些材料里、原文是怎么写的」。"
-                  + "返回文件名、Sheet 名、来源表名、时间与命中的原文片段,"
-                  + "其中 content 列里用 <em class=\"search-highlight\"> 标记了命中的关键词。"
-                  + "★ 问「哪个文件/哪份材料里提到过某某」「某某在原文里出现过吗」时用本工具。"
-                  + "keyword 必填且不能为空白,支持姓名、号码、卡号等任意文本,按内容模糊匹配(两侧自动加通配符,"
-                  + "所以关键词越具体越准,不要只传一个字)。"
-                  + "注意:本工具查的是「原文内容」,不是结构化字段 —— 要按字段条件筛选、聚合、排序、统计时,"
-                  + "请改用 execute_sql 或对应的业务统计工具。结果以可翻页表格返回(最多 500 行)。",
-          readOnly = true)
-    public ToolResultBlock searchGlobal(
-            @ToolParam(name = "keyword",
-                       description = "检索关键词(必填,不能为空白);姓名、号码、卡号、地名等均可,按内容模糊匹配",
-                       required = true)
-            String keyword) {
-        String text = trimToNull(keyword);
-        if (text == null) {
-            return ToolResults.error("keyword 不能为空");
-        }
-        try {
-            List<SearchDTO> list = searchService.search(text);
-            if (list != null && list.size() > FETCH_LIMIT) {
-                return overLimit(list.size());
-            }
-            return ToolResultTable.store(sqlResultStore, null, list, 1,
-                    ToolResultTable.normalizePageSize(null));
-        } catch (Exception e) {
-            return fail("全文检索", e);
-        }
-    }
-
-    /**
-     * 案件配置的特殊日期清单
-     */
-    @Tool(name = "list_special_dates",
-          description = "列出当前案件配置的全部「特殊日期 / 敏感日期」(用户添加的与内置的都在内)。"
-                  + "返回每条日期的名称(name)、公历或农历(type:0 公历、1 农历)、前后间隔天数(gap)、"
-                  + "日期(spDate,MM-dd 形式)、是否为内置(flag:0 内置、1 用户添加)。"
-                  + "★ 问「案件配置了哪些特殊日期」「敏感日期/节假日有哪些」「某个节日是哪天」时用本工具,"
-                  + "不要用 execute_sql 去查 special_date_reord 表。"
-                  + "本工具只读、无入参。"
-                  + "拿到日期清单后,若要分析这些日期内谁和谁联系过,请接着用 stat_call_sensitive_summary / "
-                  + "stat_call_sensitive_detail。",
-          readOnly = true)
-    public ToolResultBlock listSpecialDates() {
-        try {
-            List<SpecialDateRecord> list = specialDateService.listRecord();
-            if (list != null && list.size() > FETCH_LIMIT) {
-                return overLimit(list.size());
-            }
-            return ToolResultTable.store(sqlResultStore, null, list, 1,
-                    ToolResultTable.normalizePageSize(null));
-        } catch (Exception e) {
-            return fail("特殊日期列表查询", e);
-        }
-    }
-
-    /**
-     * 行为时间轴列表
-     */
-    @Tool(name = "get_time_series",
-          description = "查询案件行为时间轴(time_series_info 表):把某人的通话、交易、轨迹等行为按时间排成一条轴,"
-                  + "返回所属来源表英文名/中文名、人员、行为时间 seriesDateTime 以及 ext1~ext9 扩展字段。"
-                  + "★ 问「某人的行为时间轴」「某段时间内某人有哪些行为/轨迹点」「行为时空」时用本工具。"
-                  + "可按 personNames(人员,多个 OR)、types(TRANS 交易 / CALL 通信 / TRACK 轨迹)、"
-                  + "startDate、endDate、hasLocal(Y 表示只要带本地坐标的记录)筛选。"
-                  + "本工具一次最多返回 20 行(SQL 内置 limit 20),按时间轴行号升序;"
-                  + "要往后翻页就把上一页最后一行的 rowId 作为 rowId 传入(rowIdSymbol 默认 GT),向前翻传 LT/LE。"
-                  + "所有条件都不传只会返回最早 20 行,意义不大,建议至少给出 personNames 或日期范围。"
-                  + "拿到某行的 id 与 tableNameEn 后,用 get_time_series_detail 看该行完整字段,"
-                  + "用 jump_time_series 看它前后的相邻行为。",
-          readOnly = true)
-    public ToolResultBlock getTimeSeries(
-            @ToolParam(name = "query", description = "行为时间轴筛选条件,字段全部可选")
-            OtgToolSpecs.TimeSeriesListSpec query) {
-        OtgToolSpecs.TimeSeriesListSpec spec =
-                query == null ? new OtgToolSpecs.TimeSeriesListSpec() : query;
-        try {
-            TimeSeriesQuery q = new TimeSeriesQuery();
-            q.setPersonNames(cleanList(spec.personNames));
-            q.setTypes(parseTypes(spec.types));
-            q.setHasLocal(parseHasLocal(spec.hasLocal));
-            q.setRowId(longOrNull(spec.rowId));
-            q.setRowIdSymbol(parseSymbol(spec.rowIdSymbol));
-            q.setStartDate(parseDate(spec.startDate, "startDate"));
-            q.setEndDate(parseDate(spec.endDate, "endDate"));
-            applyFetchWindow(q);
-
-            List<TimeSeries> list = timeSeriesService.getTimeSeries(q);
-            if (list != null && list.size() > FETCH_LIMIT) {
-                return overLimit(list.size());
-            }
-            return ToolResultTable.store(sqlResultStore, null, list, 1,
-                    ToolResultTable.normalizePageSize(spec.pageSize));
-        } catch (Exception e) {
-            return fail("行为时间轴查询", e);
-        }
-    }
-
-    /**
-     * 行为时间轴相邻记录(跳转)
-     */
-    @Tool(name = "jump_time_series",
-          description = "以时间轴上的某条记录为锚点,返回它在时间轴上前后各 10 条相邻记录(共最多 21 条),"
-                  + "用于回答「这条行为前后还发生了什么」。"
-                  + "★ 必须传 id —— 取 get_time_series 结果里的 id 列。"
-                  + "startDate / endDate 可选,仅用于限定锚点记录的日期;一般不用传,"
-                  + "传了却在范围内找不到该 id 会返回空结果。"
-                  + "若要查看某条记录的完整明细字段,请改用 get_time_series_detail。",
-          readOnly = true)
-    public ToolResultBlock jumpTimeSeries(
-            @ToolParam(name = "query", description = "跳转锚点参数,id 必填")
-            OtgToolSpecs.TimeSeriesJumpSpec query) {
-        OtgToolSpecs.TimeSeriesJumpSpec spec =
-                query == null ? new OtgToolSpecs.TimeSeriesJumpSpec() : query;
-        try {
-            Long id = longOrNull(spec.id);
-            if (id == null) {
-                return ToolResults.error("id 不能为空:请先用 get_time_series 查询时间轴并取其 id 列");
-            }
-            TimeSeriesQuery q = new TimeSeriesQuery();
-            q.setId(id);
-            q.setStartDate(parseDate(spec.startDate, "startDate"));
-            q.setEndDate(parseDate(spec.endDate, "endDate"));
-            applyFetchWindow(q);
-
-            List<TimeSeries> list = timeSeriesService.jumpTimeSeries(q);
-            if (list != null && list.size() > FETCH_LIMIT) {
-                return overLimit(list.size());
-            }
-            return ToolResultTable.store(sqlResultStore, null, list, 1,
-                    ToolResultTable.normalizePageSize(spec.pageSize));
-        } catch (Exception e) {
-            return fail("行为时间轴跳转查询", e);
-        }
-    }
-
-    /**
-     * 行为时间轴记录明细
-     */
-    @Tool(name = "get_time_series_detail",
-          description = "查询时间轴上某一条记录在「它所属的来源业务表」里的完整明细,并附带该来源表的中文表头定义。"
-                  + "★ 必须同时传 tableNameEn 与 id:tableNameEn 取 get_time_series 结果里的 tableNameEn 列"
-                  + "(如 call_record 通话、trans_record 交易、hotel_stay_info 住宿、express_info 快递、"
-                  + "train_ticket_info 火车票、flight_ticket_info 机票等),id 取同一行的 id 列。"
-                  + "personName 可选,用于在 id 之外再校验人员,一般不用传。"
-                  + "返回固定两行两列(key / value):key=head 时 value 是该来源表的中文表头定义"
-                  + "(JSON 数组,含字段名与中文标题,可据此解释 dt 里的字段);"
-                  + "key=dt 时 value 是该条记录的完整字段(JSON 对象);记录不存在时 dt 的 value 为 null。"
-                  + "注意 value 是 JSON 文本,过长时会被截断到 500 字符。"
-                  + "若要按字段条件批量筛选来源表,请改用 execute_sql。",
-          readOnly = true)
-    public ToolResultBlock getTimeSeriesDetail(
-            @ToolParam(name = "query", description = "明细定位参数,tableNameEn 与 id 必填")
-            OtgToolSpecs.TimeSeriesDetailSpec query) {
-        OtgToolSpecs.TimeSeriesDetailSpec spec =
-                query == null ? new OtgToolSpecs.TimeSeriesDetailSpec() : query;
-        try {
-            String tableNameEn = trimToNull(spec.tableNameEn);
-            if (tableNameEn == null) {
-                return ToolResults.error("tableNameEn 不能为空:请先用 get_time_series 查询时间轴并取其 tableNameEn 列");
-            }
-            Long id = longOrNull(spec.id);
-            if (id == null) {
-                return ToolResults.error("id 不能为空:请先用 get_time_series 查询时间轴并取其 id 列");
-            }
-            TimeSeriesQuery q = new TimeSeriesQuery();
-            // 该 service 用 tableName 去 TableInfoHelper / GlobalCache 里按「表名」定位实体,
-            // 所以这里把模型给的英文表名映射到基类 tableName 上(并不把 tableName 暴露为入参名)。
-            q.setTableName(tableNameEn);
-            q.setId(id);
-            q.setPersonName(trimToNull(spec.personName));
-
-            Map<String, Object> detail = timeSeriesService.detailTimeSeries(q);
-            return ToolResultTable.store(sqlResultStore, null, flattenDetail(detail), 1,
-                    ToolResultTable.normalizePageSize(spec.pageSize));
-        } catch (Exception e) {
-            return fail("行为时间轴明细查询", e);
-        }
-    }
-
-    // ==================== 内部实现 ====================
-
-    /**
-     * 分页取全量:页大小设为 {@code FETCH_LIMIT + 1},让数据库只回上限内的数据。
-     *
-     * <p>本组时间轴 SQL 目前内置了 {@code limit 20} / {@code rowid ±10},page/limit 实际不生效,
-     * 这里仍按统一约定设置取数窗口,避免日后 XML 支持分页时各工具口径不一致。
-     */
-    private static void applyFetchWindow(Query query) {
-        query.setPage(1);
-        query.setLimit(FETCH_LIMIT + 1L);
-    }
-
-    /**
-     * 把 {@code detailTimeSeries} 返回的 {@code Map} 拍平成两行 {@code key/value} 表格。
-     *
-     * <p>该接口返回的是 {@code {head: 表头定义, dt: 记录实体}},直接丢给表格组装器只会得到
-     * 一个「Map 的字符串形态」,模型读不出结构,所以按 entry 拍平成行。
-     */
-    private static List<Map<String, Object>> flattenDetail(Map<String, Object> detail) {
-        List<Map<String, Object>> rows = new ArrayList<>(2);
-        rows.add(detailRow("head", detail == null ? null : detail.get("head")));
-        rows.add(detailRow("dt", detail == null ? null : detail.get("dt")));
-        return rows;
-    }
-
-    /**
-     * 单个 entry 转一行:值为 null 时保留 null(而不是字符串 "null"),其余走 JSON 文本
-     */
-    private static Map<String, Object> detailRow(String key, Object value) {
-        Map<String, Object> row = new LinkedHashMap<>(2);
-        row.put("key", key);
-        row.put("value", value == null ? null : Json.toStr(value));
-        return row;
-    }
-
-    /**
-     * 结果集超限:明确报错而不是截断,否则模型会基于不完整数据下结论
-     */
-    private static ToolResultBlock overLimit(long total) {
-        return ToolResults.error("结果集过大(" + total + " 行,上限 " + FETCH_LIMIT
-                + "),请收窄人员、类型或日期范围等条件后重试");
-    }
-
-    /**
-     * 失败:区分「参数格式错」与「执行错」,后者补一句开案提示
-     */
-    private static ToolResultBlock fail(String action, Exception e) {
-        if (e instanceof IllegalArgumentException) {
-            return ToolResults.error(e.getMessage());
-        }
-        log.warn("{}失败: {}", action, e.getMessage());
-        return ToolResults.error(action + "失败: " + e.getMessage()
-                + "。若提示数据表不存在,请确认已在客户端打开案件后重试");
-    }
-
-    /**
-     * 数据类型解析:枚举名 → 枚举。
-     *
-     * <p>{@code TimeSeriesTypeEnum} 里每种类型挂着多个来源表名,service 会把它们 flatMap 成
-     * 表名列表再拼 {@code tableNameEn IN (...)},所以模型只需给类型名,不用也不该给表名。
-     */
-    private static List<TimeSeriesTypeEnum> parseTypes(List<String> names) {
-        List<String> cleaned = cleanList(names);
-        if (cleaned == null) {
-            return null;
-        }
-        List<TimeSeriesTypeEnum> types = new ArrayList<>(cleaned.size());
-        for (String name : cleaned) {
-            try {
-                types.add(TimeSeriesTypeEnum.valueOf(name.toUpperCase(Locale.ROOT)));
-            } catch (IllegalArgumentException e) {
-                throw new IllegalArgumentException("types 取值不合法(只支持 TRANS / CALL / TRACK):" + name);
-            }
-        }
-        return types;
-    }
-
-    /**
-     * 游标比较符解析:只认枚举名,转成 {@link SymbolEnum} 后再由 getter 吐符号。
-     *
-     * <p>SQL 里 {@code rowid} 的比较符是 {@code ${query.rowIdSymbol}} 直接拼接的,
-     * 所以这里绝不能把模型给的字符串原样透传 —— 必须经枚举白名单转换。
-     */
-    private static SymbolEnum parseSymbol(String value) {
-        String text = trimToNull(value);
-        if (text == null) {
-            return null;
-        }
-        try {
-            return SymbolEnum.valueOf(text.toUpperCase(Locale.ROOT));
-        } catch (IllegalArgumentException e) {
-            throw new IllegalArgumentException("rowIdSymbol 取值不合法(只支持 GT / GE / LT / LE / EQ):" + value);
-        }
-    }
-
-    /**
-     * 本地坐标标识解析:SQL 只对 {@code "Y"} 分支拼 {@code ext8/ext9 IS NOT NULL},
-     * 传错值会静默变成「不过滤」,因此这里显式校验而不是放过。
-     */
-    private static String parseHasLocal(String value) {
-        String text = trimToNull(value);
-        if (text == null) {
-            return null;
-        }
-        String upper = text.toUpperCase(Locale.ROOT);
-        if (!"Y".equals(upper) && !"N".equals(upper)) {
-            throw new IllegalArgumentException("hasLocal 取值不合法(只支持 Y 或 N):" + value);
-        }
-        return upper;
-    }
-
-    /**
-     * 日期解析:只接受 {@code yyyy-MM-dd},报错信息带字段名,便于模型自我修正
-     */
-    private static LocalDate parseDate(String value, String field) {
-        String text = trimToNull(value);
-        if (text == null) {
-            return null;
-        }
-        try {
-            return LocalDate.parse(text);
-        } catch (DateTimeParseException e) {
-            throw new IllegalArgumentException(field + " 格式不合法(应为 yyyy-MM-dd,如 2024-01-31):" + value);
-        }
-    }
-
-    /**
-     * 清空串/去空白:XML 里部分条件只判 {@code != null},传空串会拼出 {@code = ''} 导致恒空结果,
-     * 必须归一成 null。
-     */
-    private static String trimToNull(String value) {
-        if (value == null) {
-            return null;
-        }
-        String trimmed = value.trim();
-        return trimmed.isEmpty() ? null : trimmed;
-    }
-
-    /**
-     * 列表清洗:去空白、去空串、去重保序;空列表归一成 null
-     */
-    private static List<String> cleanList(List<String> values) {
-        if (values == null || values.isEmpty()) {
-            return null;
-        }
-        LinkedHashSet<String> cleaned = new LinkedHashSet<>();
-        values.stream().map(OtgAnalysisTool::trimToNull)
-                .filter(Objects::nonNull).forEach(cleaned::add);
-        return cleaned.isEmpty() ? null : new ArrayList<>(cleaned);
-    }
-
-    /**
-     * 数值转 Long:{@code Number} 入参统一在工具内收敛类型
-     */
-    private static Long longOrNull(Number value) {
-        return value == null ? null : value.longValue();
-    }
-}

+ 0 - 139
ai-server/src/main/java/com/zsjz/ai/module/agent/tools/OtgToolSpecs.java

@@ -1,139 +0,0 @@
-package com.zsjz.ai.module.agent.tools;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import io.agentscope.core.tool.ToolParam;
-
-import java.util.List;
-
-/**
- * 行为时空 / 全文检索类工具({@link OtgAnalysisTool})的入参结构。
- *
- * <p>写法与 {@link CallToolSpecs} 完全一致:<b>public 字段 + {@link ToolParam}</b>,
- * AgentScope 据此生成嵌套 JSON Schema,并在调用前用该 schema 校验,LLM 传的是嵌套 JSON 对象。
- *
- * <p>为什么不直接复用 {@code com.zsjz.ai.common.model.otg.query.TimeSeriesQuery}:
- * <ul>
- *   <li>它继承自 {@code Query},带 {@code orderKey} / {@code sort} / {@code tableName},
- *       而 Mapper XML 里有 {@code order by ${query.orderKey} ${query.sort}} 这类拼接点,
- *       直接暴露等于给模型开了 SQL 注入面;</li>
- *   <li>暴露无关字段只会让 schema 变脏、模型更容易填错。</li>
- * </ul>
- * 因此这里只声明<b>真正参与 SQL 条件</b>的业务字段,工具内部再映射成 Query(排序等由工具硬编码)。
- *
- * <p>约定:日期统一收 {@code yyyy-MM-dd} 字符串(工具内 {@code LocalDate.parse},失败给出可读报错);
- * 数值一律 {@link Number} 而不是 {@code Long},否则整数会被序列化成 {@code 3.0}。
- */
-public final class OtgToolSpecs {
-
-    private OtgToolSpecs() {
-    }
-
-    /**
-     * 行为时间轴列表查询参数({@code get_time_series})
-     */
-    @JsonInclude(JsonInclude.Include.NON_NULL)
-    public static class TimeSeriesListSpec {
-
-        /** 本方姓名列表 */
-        @ToolParam(name = "personNames", description = "本方(机主)姓名,可传多个(OR 关系,精确匹配);不传则不限定人员",
-                   required = false)
-        public List<String> personNames;
-
-        /** 数据类型 */
-        @ToolParam(name = "types",
-                   description = "数据类型,可传多个;取值 TRANS(交易信息)、CALL(通信信息)、TRACK(轨迹信息),不传则不限类型",
-                   required = false)
-        public List<String> types;
-
-        /** 是否只取带本地坐标的记录 */
-        @ToolParam(name = "hasLocal",
-                   description = "是否只取带本地坐标的记录,取值 Y 或 N;Y 表示只要 ext8、ext9 都非空的记录,不传则不限制",
-                   required = false)
-        public String hasLocal;
-
-        /** 游标:时间轴行号 */
-        @ToolParam(name = "rowId",
-                   description = "游标:时间轴行号,配合 rowIdSymbol 使用(翻页用);一般取上一页最后一行的 rowId 再传本参数",
-                   required = false)
-        public Number rowId;
-
-        /** 游标比较符 */
-        @ToolParam(name = "rowIdSymbol",
-                   description = "游标比较符,取值 GT(大于,默认,向后翻页)、GE(大于等于,含该行)、LT / LE(向前翻页);仅在传了 rowId 时生效",
-                   required = false)
-        public String rowIdSymbol;
-
-        /** 开始日期 */
-        @ToolParam(name = "startDate", description = "行为时间下限,格式 yyyy-MM-dd(含当天)", required = false)
-        public String startDate;
-
-        /** 结束日期 */
-        @ToolParam(name = "endDate", description = "行为时间上限,格式 yyyy-MM-dd(含当天)", required = false)
-        public String endDate;
-
-        /** 每页行数 */
-        @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500(用户可在前端表格翻页看全部)",
-                   required = false)
-        public Number pageSize;
-    }
-
-    /**
-     * 时间轴跳转(相邻记录)查询参数({@code jump_time_series})
-     */
-    @JsonInclude(JsonInclude.Include.NON_NULL)
-    public static class TimeSeriesJumpSpec {
-
-        /** 锚点记录主键 */
-        @ToolParam(name = "id",
-                   description = "锚点记录的主键 id(取 get_time_series 结果里的 id 列),必填",
-                   required = false)
-        public Number id;
-
-        /** 开始日期 */
-        @ToolParam(name = "startDate",
-                   description = "锚点记录的行为时间下限,格式 yyyy-MM-dd;一般不用传,传了却匹配不到该 id 会返回空结果",
-                   required = false)
-        public String startDate;
-
-        /** 结束日期 */
-        @ToolParam(name = "endDate",
-                   description = "锚点记录的行为时间上限,格式 yyyy-MM-dd;一般不用传,传了却匹配不到该 id 会返回空结果",
-                   required = false)
-        public String endDate;
-
-        /** 每页行数 */
-        @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
-    }
-
-    /**
-     * 时间轴记录明细查询参数({@code get_time_series_detail})
-     */
-    @JsonInclude(JsonInclude.Include.NON_NULL)
-    public static class TimeSeriesDetailSpec {
-
-        /** 来源业务表英文表名 */
-        @ToolParam(name = "tableNameEn",
-                   description = "该记录所属来源表的英文表名,必填;取 get_time_series 结果里的 tableNameEn 列,"
-                           + "如 call_record(通话)、trans_record(交易)、hotel_stay_info(住宿)、express_info(快递)、"
-                           + "train_ticket_info(火车票)、flight_ticket_info(机票)、together_live_info(同住)等",
-                   required = false)
-        public String tableNameEn;
-
-        /** 记录主键 */
-        @ToolParam(name = "id",
-                   description = "记录在来源表中的主键 id,必填;取 get_time_series 结果里的 id 列",
-                   required = false)
-        public Number id;
-
-        /** 本方姓名 */
-        @ToolParam(name = "personName",
-                   description = "本方(机主)姓名,精确匹配,用于在 id 之外再校验人员;一般不用传",
-                   required = false)
-        public String personName;
-
-        /** 每页行数 */
-        @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
-    }
-}

+ 15 - 14
ai-server/src/main/java/com/zsjz/ai/module/agent/tools/PersonToolSpecs.java

@@ -3,6 +3,7 @@ package com.zsjz.ai.module.agent.tools;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import io.agentscope.core.tool.ToolParam;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -48,7 +49,7 @@ public final class PersonToolSpecs {
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500(用户可在前端表格翻页看全部)",
                    required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -71,7 +72,7 @@ public final class PersonToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -102,7 +103,7 @@ public final class PersonToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -128,7 +129,7 @@ public final class PersonToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -165,7 +166,7 @@ public final class PersonToolSpecs {
         /** 交易次数 */
         @ToolParam(name = "transCount", description = "交易次数阈值,配合 transCountSymbol 使用(如「交易次数 >= 3」)",
                    required = false)
-        public Number transCount;
+        public Integer transCount;
 
         /** 交易次数比较符号 */
         @ToolParam(name = "transCountSymbol",
@@ -175,7 +176,7 @@ public final class PersonToolSpecs {
 
         /** 交易金额 */
         @ToolParam(name = "transAmount", description = "交易金额阈值(元),配合 transAmountSymbol 使用", required = false)
-        public Number transAmount;
+        public BigDecimal transAmount;
 
         /** 交易金额比较符号 */
         @ToolParam(name = "transAmountSymbol",
@@ -185,7 +186,7 @@ public final class PersonToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -223,7 +224,7 @@ public final class PersonToolSpecs {
 
         /** 交易次数 */
         @ToolParam(name = "transCount", description = "交易次数阈值,配合 transCountSymbol 使用", required = false)
-        public Number transCount;
+        public Integer transCount;
 
         /** 交易次数比较符号 */
         @ToolParam(name = "transCountSymbol",
@@ -233,7 +234,7 @@ public final class PersonToolSpecs {
 
         /** 交易金额 */
         @ToolParam(name = "transAmount", description = "交易金额阈值(元),配合 transAmountSymbol 使用", required = false)
-        public Number transAmount;
+        public BigDecimal transAmount;
 
         /** 交易金额比较符号 */
         @ToolParam(name = "transAmountSymbol",
@@ -245,11 +246,11 @@ public final class PersonToolSpecs {
         @ToolParam(name = "source",
                    description = "传 1 表示只看现金交易(按案件配置的现金关键字过滤摘要字段);不传或传 0 表示不限制",
                    required = false)
-        public Number source;
+        public Integer source;
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -264,7 +265,7 @@ public final class PersonToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -285,7 +286,7 @@ public final class PersonToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -313,6 +314,6 @@ public final class PersonToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 }

+ 31 - 31
ai-server/src/main/java/com/zsjz/ai/module/agent/tools/TrackToolSpecs.java

@@ -61,7 +61,7 @@ public final class TrackToolSpecs {
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500(用户可在前端表格翻页看全部)",
                    required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -108,7 +108,7 @@ public final class TrackToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     // ==================== 境外本地人员轨迹 ====================
@@ -129,21 +129,21 @@ public final class TrackToolSpecs {
         @ToolParam(name = "dayNightTotal",
                    description = "昼夜活动次数下限,只返回活动次数 >= 该值的人员-基站组合;不传则不限制",
                    required = false)
-        public Number dayNightTotal;
+        public Integer dayNightTotal;
 
         /** 白天时段阈值(小时) */
         @ToolParam(name = "morningTime",
                    description = "白天时段截止小时,取值 0-23,默认 8(即统计 06:00 至该时刻的活动);"
                            + "通常不用改",
                    required = false)
-        public Number morningTime;
+        public Integer morningTime;
 
         /** 夜间时段起点(小时) */
         @ToolParam(name = "nightTime",
                    description = "夜间时段起始小时,取值 0-23,默认 20;"
                            + "传 20/21/22/23 表示当晚到次日凌晨 05:59,传 0-19 表示凌晨到 05:59。通常不用改",
                    required = false)
-        public Number nightTime;
+        public Integer nightTime;
 
         /** 开始日期 */
         @ToolParam(name = "startDate", description = "通话日期下限,格式 yyyy-MM-dd(含当天)", required = false)
@@ -155,7 +155,7 @@ public final class TrackToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -192,13 +192,13 @@ public final class TrackToolSpecs {
         @ToolParam(name = "morningTime",
                    description = "白天时段截止小时,取值 0-23,默认 8;需与汇总查询保持一致",
                    required = false)
-        public Number morningTime;
+        public Integer morningTime;
 
         /** 夜间时段起点(小时) */
         @ToolParam(name = "nightTime",
                    description = "夜间时段起始小时,取值 0-23,默认 20;需与汇总查询保持一致",
                    required = false)
-        public Number nightTime;
+        public Integer nightTime;
 
         /** 开始日期 */
         @ToolParam(name = "startDate", description = "通话日期下限,格式 yyyy-MM-dd(含当天)", required = false)
@@ -210,7 +210,7 @@ public final class TrackToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     // ==================== 快递 ====================
@@ -243,7 +243,7 @@ public final class TrackToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -274,7 +274,7 @@ public final class TrackToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -307,7 +307,7 @@ public final class TrackToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     // ==================== 碰面 ====================
@@ -328,7 +328,7 @@ public final class TrackToolSpecs {
         @ToolParam(name = "timeInterval",
                    description = "碰面判定时间窗口(分钟),默认 30;两人在同一基站且通话时间相差不超过该值即视为碰面",
                    required = false)
-        public Number timeInterval;
+        public Integer timeInterval;
 
         /** 开始日期 */
         @ToolParam(name = "startDate", description = "通话日期下限,格式 yyyy-MM-dd(含当天)", required = false)
@@ -340,7 +340,7 @@ public final class TrackToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -377,7 +377,7 @@ public final class TrackToolSpecs {
         @ToolParam(name = "timeInterval",
                    description = "碰面判定时间窗口(分钟),默认 30;需与汇总查询保持一致",
                    required = false)
-        public Number timeInterval;
+        public Integer timeInterval;
 
         /** 开始日期 */
         @ToolParam(name = "startDate", description = "通话日期下限,格式 yyyy-MM-dd(含当天)", required = false)
@@ -389,7 +389,7 @@ public final class TrackToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     // ==================== 同住 ====================
@@ -410,7 +410,7 @@ public final class TrackToolSpecs {
         @ToolParam(name = "outCount",
                    description = "同住次数阈值,配合 outCountSymbol 使用;不传则不按次数过滤",
                    required = false)
-        public Number outCount;
+        public Integer outCount;
 
         /** 阈值比较符 */
         @ToolParam(name = "outCountSymbol",
@@ -422,13 +422,13 @@ public final class TrackToolSpecs {
         @ToolParam(name = "timeGap",
                    description = "疑似同住的时间窗口(小时),传入后才会统计「同酒店且入住时间在该窗口内」的疑似同住;不传则只统计确定同住",
                    required = false)
-        public Number timeGap;
+        public Integer timeGap;
 
         /** 疑似同住标记 */
         @ToolParam(name = "hasTogether",
                    description = "疑似同住标记:1=时间窗口内的疑似同住,2=同行且 24 小时内住宿的疑似同住;不传则只保留确定同住",
                    required = false)
-        public Number hasTogether;
+        public Integer hasTogether;
 
         /** 开始日期 */
         @ToolParam(name = "startDate", description = "住宿日期下限,格式 yyyy-MM-dd(含当天)", required = false)
@@ -440,7 +440,7 @@ public final class TrackToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -471,7 +471,7 @@ public final class TrackToolSpecs {
         @ToolParam(name = "outCount",
                    description = "同住次数阈值,配合 outCountSymbol 使用;不传则不按次数过滤",
                    required = false)
-        public Number outCount;
+        public Integer outCount;
 
         /** 阈值比较符 */
         @ToolParam(name = "outCountSymbol",
@@ -483,13 +483,13 @@ public final class TrackToolSpecs {
         @ToolParam(name = "timeGap",
                    description = "疑似同住的时间窗口(小时);不传则只统计确定同住",
                    required = false)
-        public Number timeGap;
+        public Integer timeGap;
 
         /** 疑似同住标记 */
         @ToolParam(name = "hasTogether",
                    description = "疑似同住标记:1=时间窗口内的疑似同住,2=同行且 24 小时内住宿的疑似同住;不传则只保留确定同住",
                    required = false)
-        public Number hasTogether;
+        public Integer hasTogether;
 
         /** 开始日期 */
         @ToolParam(name = "startDate", description = "住宿日期下限,格式 yyyy-MM-dd(含当天)", required = false)
@@ -501,7 +501,7 @@ public final class TrackToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -538,17 +538,17 @@ public final class TrackToolSpecs {
         @ToolParam(name = "hasTogether",
                    description = "疑似同住标记:2=同时包含同行人住宿记录;不传则只查被调查对象本人",
                    required = false)
-        public Number hasTogether;
+        public Integer hasTogether;
 
         /** 时间间隔(小时) */
         @ToolParam(name = "timeGap",
                    description = "疑似同住的时间窗口(小时);不传则只统计确定同住",
                    required = false)
-        public Number timeGap;
+        public Integer timeGap;
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -595,7 +595,7 @@ public final class TrackToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     // ==================== 同行出行 ====================
@@ -622,7 +622,7 @@ public final class TrackToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -647,7 +647,7 @@ public final class TrackToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -673,6 +673,6 @@ public final class TrackToolSpecs {
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50(本工具只返回单条记录,通常无需传)",
                    required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 }

+ 1 - 107
ai-server/src/main/java/com/zsjz/ai/module/agent/tools/TransAnalysisTool.java

@@ -95,15 +95,6 @@ public class TransAnalysisTool {
     /** 连续交易月份阈值默认值(Query 里默认 1) */
     private static final int DEFAULT_MONTH_VAL = 1;
 
-    /** 资金流向图/追踪默认展开层数 */
-    private static final int DEFAULT_LEVEL = 2;
-
-    /** 资金流向图/追踪默认时间窗口(天) */
-    private static final int DEFAULT_TIME_GAP = 3;
-
-    /** 资金流向图/追踪默认方向(1=向后,看资金流向哪去) */
-    private static final int DEFAULT_DIRECTION = 1;
-
     /** 交易明细默认排序字段(真实列名,硬编码,不来自模型) */
     private static final String DEFAULT_ORDER_KEY = "transDateTime";
 
@@ -251,7 +242,7 @@ public class TransAnalysisTool {
                 return ToolResults.error("groupId 不能为空(人员分组ID,可用 list_person_groups 工具查询)");
             }
             StatTogetherDoTransQuery q = new StatTogetherDoTransQuery();
-            q.setGroupId(spec.groupId.longValue());
+            q.setGroupId(spec.groupId);
             q.setTransAmount(toDecimal(spec.transAmount));
             q.setTransAmountSymbol(parseSymbol(spec.transAmountSymbol, "transAmountSymbol"));
             q.setDayGap(toInt(spec.dayGap));
@@ -572,74 +563,6 @@ public class TransAnalysisTool {
         }
     }
 
-    /**
-     * 资金流向图逐层展开
-     */
-    @Tool(name = "stat_trans_flow_graph",
-          description = "以一笔交易为起点逐层展开资金流向树:向前看「这笔钱从哪来」或向后看「这笔钱流向哪去」,"
-                  + "可控制层数与每层时间窗口,可只看现金交易。"
-                  + "★ 问「这笔钱最终流到哪」「资金穿透」「几层流转」时用本工具。"
-                  + "起点参数(personCardNos / otherName / otherCardNo / transDateTime / debitCreditFlag)"
-                  + "从 get_trans_fund_flow 的结果里取。"
-                  + "level 默认 2(1-4),timeGap 默认 3 天,direction 默认 1=向后。"
-                  + "返回的是**嵌套树形 JSON**(不是表格),字段含 name/personCardNos/otherCardNos/children,"
-                  + "可据此组织结论,也可配合 render_graph 展示。",
-          readOnly = true)
-    public ToolResultBlock statTransFlowGraph(
-            @ToolParam(name = "query", description = "资金流向图起点与展开参数")
-            TransToolSpecs.TransFlowGraphSpec query) {
-        TransToolSpecs.TransFlowGraphSpec spec =
-                query == null ? new TransToolSpecs.TransFlowGraphSpec() : query;
-        try {
-            TransFlowGraphQuery q = new TransFlowGraphQuery();
-            q.setTableName(null);
-            q.setFlowPageDTO(buildFlowRecord(spec.personCardNos, spec.otherName,
-                    spec.otherCardNo, spec.debitCreditFlag, spec.transDateTime));
-            q.setDirection(toIntOrDefault(spec.direction, DEFAULT_DIRECTION));
-            q.setLevel(toIntOrDefault(spec.level, DEFAULT_LEVEL));
-            q.setTimeGap(toIntOrDefault(spec.timeGap, DEFAULT_TIME_GAP));
-            q.setCashOnly(toIntOrDefault(spec.cashOnly, 0));
-
-            Object result = transFundFlowService.transFlowGraph(q);
-            return ToolResults.ok(com.zsjz.ai.common.utils.Json.toStr(result));
-        } catch (Exception e) {
-            return fail("资金流向图展开", e);
-        }
-    }
-
-    /**
-     * 资金流向追踪
-     */
-    @Tool(name = "stat_trans_flow_trace",
-          description = "从一笔起点交易出发按指定方向继续追踪资金路径,返回追踪路径的**嵌套树形 JSON**。"
-                  + "与 stat_trans_flow_graph 的区别:graph 是「逐层展开」,trace 是「沿路径追踪」。"
-                  + "★ 问「顺着这笔钱往下追」「资金链路」时用本工具。"
-                  + "起点参数从 get_trans_fund_flow 结果里取;traceDirection 默认 1=向后(资金流向哪去),"
-                  + "level 默认 2,timeGap 默认 3 天。",
-          readOnly = true)
-    public ToolResultBlock statTransFlowTrace(
-            @ToolParam(name = "query", description = "资金流向追踪起点与追踪参数")
-            TransToolSpecs.TransFlowTraceSpec query) {
-        TransToolSpecs.TransFlowTraceSpec spec =
-                query == null ? new TransToolSpecs.TransFlowTraceSpec() : query;
-        try {
-            TransFlowPageDTO record = buildFlowRecord(spec.personCardNos, spec.otherName,
-                    spec.otherCardNo, spec.debitCreditFlag, spec.transDateTime);
-            TransFlowGraphQuery q = new TransFlowGraphQuery();
-            q.setFlowPageDTO(record);
-            q.setTraceParamList(List.of(record));
-            q.setTraceDirection(toIntOrDefault(spec.traceDirection, DEFAULT_DIRECTION));
-            q.setLevel(toIntOrDefault(spec.level, DEFAULT_LEVEL));
-            q.setTimeGap(toIntOrDefault(spec.timeGap, DEFAULT_TIME_GAP));
-            q.setCashOnly(toIntOrDefault(spec.cashOnly, 0));
-
-            Object result = transFundFlowService.transFlowTrace(q);
-            return ToolResults.ok(com.zsjz.ai.common.utils.Json.toStr(result));
-        } catch (Exception e) {
-            return fail("资金流向追踪", e);
-        }
-    }
-
     /**
      * 交易明细(原始记录)
      */
@@ -776,20 +699,6 @@ public class TransAnalysisTool {
         q.setSort(DEFAULT_SORT);
     }
 
-    /**
-     * 组装资金流向图/追踪的「起点交易」记录({@link TransFlowPageDTO})
-     */
-    private static TransFlowPageDTO buildFlowRecord(List<String> personCardNos, String otherName,
-                                                    List<String> otherCardNo, String debitCreditFlag,
-                                                    String transDateTime) {
-        TransFlowPageDTO record = new TransFlowPageDTO();
-        record.setPersonCardNos(cleanList(personCardNos));
-        record.setOtherName(trimToNull(otherName));
-        record.setOtherCardNo(cleanList(otherCardNo));
-        record.setDebitCreditFlag(trimToNull(debitCreditFlag));
-        record.setTransDateTime(parseDateTime(transDateTime, "transDateTime"));
-        return record;
-    }
 
     // ==================== 结果拍平 ====================
 
@@ -980,21 +889,6 @@ public class TransAnalysisTool {
         }
     }
 
-    /**
-     * 日期时间解析:只接受 {@code yyyy-MM-dd HH:mm:ss}
-     */
-    private static LocalDateTime parseDateTime(String value, String field) {
-        String text = trimToNull(value);
-        if (text == null) {
-            return null;
-        }
-        try {
-            return LocalDateTime.parse(text.replace(' ', 'T'));
-        } catch (DateTimeParseException e) {
-            throw new IllegalArgumentException(field + " 格式不合法(应为 yyyy-MM-dd HH:mm:ss):" + value);
-        }
-    }
-
     /**
      * 比较符解析:{@code GE/LE/GT/LT/EQ}(大小写不敏感),空值返回 null 走 Query 的默认值
      */

+ 30 - 132
ai-server/src/main/java/com/zsjz/ai/module/agent/tools/TransToolSpecs.java

@@ -3,6 +3,7 @@ package com.zsjz.ai.module.agent.tools;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import io.agentscope.core.tool.ToolParam;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -49,7 +50,7 @@ public final class TransToolSpecs {
         /** 交易金额阈值 */
         @ToolParam(name = "transAmount", description = "交易金额阈值,配合 transAmountSymbol 使用(如 50000 表示金额 ≥ 5 万)",
                    required = false)
-        public Number transAmount;
+        public BigDecimal transAmount;
 
         /** 金额比较符 */
         @ToolParam(name = "transAmountSymbol", description = "金额比较符,取值 GE(>=,默认) / LE(<=) / GT(>) / LT(<) / EQ(=)",
@@ -58,7 +59,7 @@ public final class TransToolSpecs {
 
         /** 交易次数阈值 */
         @ToolParam(name = "transCount", description = "交易次数阈值,配合 transCountSymbol 使用", required = false)
-        public Number transCount;
+        public Integer transCount;
 
         /** 次数比较符 */
         @ToolParam(name = "transCountSymbol", description = "次数比较符,取值 GE(>=,默认) / LE(<=) / GT(>) / LT(<) / EQ(=)",
@@ -75,7 +76,7 @@ public final class TransToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -89,11 +90,11 @@ public final class TransToolSpecs {
 
         /** 人员分组ID */
         @ToolParam(name = "groupId", description = "人员分组ID(必填);可用 list_person_groups 工具查询分组列表")
-        public Number groupId;
+        public Long groupId;
 
         /** 金额阈值 */
         @ToolParam(name = "transAmount", description = "单笔交易金额阈值,配合 transAmountSymbol", required = false)
-        public Number transAmount;
+        public BigDecimal transAmount;
 
         /** 金额比较符 */
         @ToolParam(name = "transAmountSymbol", description = "金额比较符,取值 GE(>=,默认) / LE(<=) / GT(>) / LT(<) / EQ(=)",
@@ -103,7 +104,7 @@ public final class TransToolSpecs {
         /** 天数间隔阈值 */
         @ToolParam(name = "dayGap", description = "共同交易的时间间隔(天)阈值,配合 daySymbol;如 dayGap=3 表示 3 天内共同交易",
                    required = false)
-        public Number dayGap;
+        public Integer dayGap;
 
         /** 天数比较符 */
         @ToolParam(name = "daySymbol", description = "天数比较符,取值 GE(>=) / LE(<=) / GT(>) / LT(<) / EQ(=)",
@@ -113,7 +114,7 @@ public final class TransToolSpecs {
         /** 交易卡数阈值 */
         @ToolParam(name = "cardNum", description = "涉及交易卡数量阈值,配合 cardNumSymbol(服务端在内存中按此过滤)",
                    required = false)
-        public Number cardNum;
+        public Integer cardNum;
 
         /** 卡数比较符 */
         @ToolParam(name = "cardNumSymbol", description = "卡数比较符,取值 GE(>=) / LE(<=) / GT(>) / LT(<) / EQ(=)",
@@ -134,7 +135,7 @@ public final class TransToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -147,11 +148,11 @@ public final class TransToolSpecs {
 
         /** 人员分组ID */
         @ToolParam(name = "groupId", description = "人员分组ID(必填);可用 list_person_groups 工具查询分组列表")
-        public Number groupId;
+        public Long groupId;
 
         /** 金额阈值 */
         @ToolParam(name = "transAmount", description = "交易金额阈值,配合 transAmountSymbol", required = false)
-        public Number transAmount;
+        public BigDecimal transAmount;
 
         /** 金额比较符 */
         @ToolParam(name = "transAmountSymbol", description = "金额比较符,取值 GE(>=,默认) / LE(<=) / GT(>) / LT(<) / EQ(=)",
@@ -201,7 +202,7 @@ public final class TransToolSpecs {
 
         /** 金额阈值 */
         @ToolParam(name = "transAmount", description = "单笔交易金额阈值,配合 transAmountSymbol", required = false)
-        public Number transAmount;
+        public BigDecimal transAmount;
 
         /** 金额比较符 */
         @ToolParam(name = "transAmountSymbol", description = "金额比较符,取值 GE(>=,默认) / LE(<=) / GT(>) / LT(<) / EQ(=)",
@@ -210,7 +211,7 @@ public final class TransToolSpecs {
 
         /** 次数阈值 */
         @ToolParam(name = "transCount", description = "交易次数阈值,配合 transCountSymbol", required = false)
-        public Number transCount;
+        public Integer transCount;
 
         /** 次数比较符 */
         @ToolParam(name = "transCountSymbol", description = "次数比较符,取值 GE(>=,默认) / LE(<=) / GT(>) / LT(<) / EQ(=)",
@@ -227,7 +228,7 @@ public final class TransToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -257,15 +258,15 @@ public final class TransToolSpecs {
 
         /** 连续月份阈值 */
         @ToolParam(name = "monthVal", description = "连续月份阈值:只统计连续交易月数 ≥ 该值的对象,默认 1", required = false)
-        public Number monthVal;
+        public Integer monthVal;
 
         /** 最小金额 */
         @ToolParam(name = "minTransMoney", description = "单笔金额下限(含)", required = false)
-        public Number minTransMoney;
+        public BigDecimal minTransMoney;
 
         /** 最大金额 */
         @ToolParam(name = "maxTransMoney", description = "单笔金额上限(含)", required = false)
-        public Number maxTransMoney;
+        public BigDecimal maxTransMoney;
 
         /** 开始日期 */
         @ToolParam(name = "startDate", description = "交易日期下限,格式 yyyy-MM-dd(含当天)", required = false)
@@ -277,7 +278,7 @@ public final class TransToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -302,11 +303,11 @@ public final class TransToolSpecs {
         /** 时间窗口小时数 */
         @ToolParam(name = "hour", description = "「先收后支」的时间窗口小时数,如 24 表示 24 小时内进出;建议传,否则结果偏多",
                    required = false)
-        public Number hour;
+        public Integer hour;
 
         /** 金额阈值 */
         @ToolParam(name = "transAmount", description = "单笔金额阈值,配合 transAmountSymbol", required = false)
-        public Number transAmount;
+        public BigDecimal transAmount;
 
         /** 金额比较符 */
         @ToolParam(name = "transAmountSymbol", description = "金额比较符,取值 GE(>=,默认) / LE(<=) / GT(>) / LT(<) / EQ(=)",
@@ -357,7 +358,7 @@ public final class TransToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -386,7 +387,7 @@ public final class TransToolSpecs {
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500(仅第二层明细用)",
                    required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -414,7 +415,7 @@ public final class TransToolSpecs {
 
         /** 次数阈值 */
         @ToolParam(name = "transCount", description = "交易次数阈值,配合 transCountSymbol", required = false)
-        public Number transCount;
+        public Integer transCount;
 
         /** 次数比较符 */
         @ToolParam(name = "transCountSymbol", description = "次数比较符,取值 GE(>=,默认) / LE(<=) / GT(>) / LT(<) / EQ(=)",
@@ -431,7 +432,7 @@ public final class TransToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 
     /**
@@ -468,15 +469,15 @@ public final class TransToolSpecs {
 
         /** 金额下限 */
         @ToolParam(name = "minTransAmount", description = "单笔金额下限(含)", required = false)
-        public Number minTransAmount;
+        public BigDecimal minTransAmount;
 
         /** 金额上限 */
         @ToolParam(name = "maxTransAmount", description = "单笔金额上限(含)", required = false)
-        public Number maxTransAmount;
+        public BigDecimal maxTransAmount;
 
         /** 金额阈值 */
         @ToolParam(name = "transAmount", description = "单笔金额阈值,配合 transAmountSymbol", required = false)
-        public Number transAmount;
+        public Integer transAmount;
 
         /** 金额比较符 */
         @ToolParam(name = "transAmountSymbol", description = "金额比较符,取值 GE(>=,默认) / LE(<=) / GT(>) / LT(<) / EQ(=)",
@@ -498,7 +499,7 @@ public final class TransToolSpecs {
         /** 是否只看现金交易 */
         @ToolParam(name = "cashOnly", description = "是否只看现金类交易:1=是(按「现金关键词」配置匹配交易扩展字段),不传=否",
                    required = false)
-        public Number cashOnly;
+        public Integer cashOnly;
 
         /** 开始日期 */
         @ToolParam(name = "startDate", description = "交易日期下限,格式 yyyy-MM-dd(含当天)", required = false)
@@ -510,110 +511,7 @@ public final class TransToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
-    }
-
-    /**
-     * 资金流向图展开入参({@code stat_trans_flow_graph})
-     *
-     * <p>口径:以「某笔交易」为起点,向前(资金从哪来)或向后(资金流向哪去)逐层展开,
-     * 层数与时间窗口可控,可只看现金交易。
-     */
-    @JsonInclude(JsonInclude.Include.NON_NULL)
-    public static class TransFlowGraphSpec {
-
-        /** 本方卡号 */
-        @ToolParam(name = "personCardNos", description = "起点交易的「本方卡号」列表;从 get_trans_fund_flow 结果里取 personCardNos",
-                   required = false)
-        public List<String> personCardNos;
-
-        /** 对方姓名 */
-        @ToolParam(name = "otherName", description = "起点交易的「对方姓名」;从 get_trans_fund_flow 结果里取",
-                   required = false)
-        public String otherName;
-
-        /** 对方卡号 */
-        @ToolParam(name = "otherCardNo", description = "起点交易的「对方卡号」列表;从 get_trans_fund_flow 结果里取",
-                   required = false)
-        public List<String> otherCardNo;
-
-        /** 收付方向 */
-        @ToolParam(name = "debitCreditFlag", description = "起点交易的收付方向,取值「收入」或「支出」;决定资金流向的判定",
-                   required = false)
-        public String debitCreditFlag;
-
-        /** 交易时间 */
-        @ToolParam(name = "transDateTime",
-                   description = "起点交易的交易时间,格式 yyyy-MM-dd HH:mm:ss(从 get_trans_fund_flow 结果里取);建议传,用于时间窗口计算",
-                   required = false)
-        public String transDateTime;
-
-        /** 展开方向 */
-        @ToolParam(name = "direction", description = "展开方向:1=向后(资金流向哪去),其他=向前(资金从哪来);默认 1",
-                   required = false)
-        public Number direction;
-
-        /** 展开层数 */
-        @ToolParam(name = "level", description = "展开层数,1-4;1=只到起点,2=展开一层;默认 2", required = false)
-        public Number level;
-
-        /** 时间窗口天数 */
-        @ToolParam(name = "timeGap", description = "每层展开的时间窗口(天),如 3 表示只看 3 天内的后续交易;默认 3",
-                   required = false)
-        public Number timeGap;
-
-        /** 是否只看现金 */
-        @ToolParam(name = "cashOnly", description = "是否只看现金交易:1=是(需先配置「现金关键词」),默认 0",
-                   required = false)
-        public Number cashOnly;
-    }
-
-    /**
-     * 资金流向追踪入参({@code stat_trans_flow_trace})
-     *
-     * <p>口径:以「一笔起点交易」为起点,按指定方向继续追踪,返回追踪路径的树形结构。
-     */
-    @JsonInclude(JsonInclude.Include.NON_NULL)
-    public static class TransFlowTraceSpec {
-
-        /** 本方卡号 */
-        @ToolParam(name = "personCardNos", description = "起点交易的「本方卡号」列表", required = false)
-        public List<String> personCardNos;
-
-        /** 对方姓名 */
-        @ToolParam(name = "otherName", description = "起点交易的「对方姓名」", required = false)
-        public String otherName;
-
-        /** 对方卡号 */
-        @ToolParam(name = "otherCardNo", description = "起点交易的「对方卡号」列表", required = false)
-        public List<String> otherCardNo;
-
-        /** 收付方向 */
-        @ToolParam(name = "debitCreditFlag", description = "起点交易的收付方向,取值「收入」或「支出」", required = false)
-        public String debitCreditFlag;
-
-        /** 交易时间 */
-        @ToolParam(name = "transDateTime",
-                   description = "起点交易的交易时间,格式 yyyy-MM-dd HH:mm:ss;建议传,用于时间窗口计算",
-                   required = false)
-        public String transDateTime;
-
-        /** 追踪方向 */
-        @ToolParam(name = "traceDirection", description = "追踪方向:1=向后(资金流向哪去),其他=向前(资金从哪来);默认 1",
-                   required = false)
-        public Number traceDirection;
-
-        /** 层数 */
-        @ToolParam(name = "level", description = "追踪层数,默认 2", required = false)
-        public Number level;
-
-        /** 时间窗口天数 */
-        @ToolParam(name = "timeGap", description = "每层追踪的时间窗口(天),默认 3", required = false)
-        public Number timeGap;
-
-        /** 是否只看现金 */
-        @ToolParam(name = "cashOnly", description = "是否只看现金交易:1=是,默认 0", required = false)
-        public Number cashOnly;
+        public Long pageSize;
     }
 
     /**
@@ -651,6 +549,6 @@ public final class TransToolSpecs {
 
         /** 每页行数 */
         @ToolParam(name = "pageSize", description = "返回给模型的首屏行数,默认 50,上限 500", required = false)
-        public Number pageSize;
+        public Long pageSize;
     }
 }

+ 0 - 2
ai-server/src/test/java/com/zsjz/ai/module/agent/tools/AgentToolRegistryTest.java

@@ -89,8 +89,6 @@ class AgentToolRegistryTest {
                 mock(TrackCellTowerService.class), mock(TrackEnLocalService.class),
                 mock(TrackExpressInfoService.class), mock(TrackMeetService.class),
                 mock(TrackTogetherLiveService.class), mock(TrackTogetherTravelService.class),
-                mock(SearchService.class), mock(SpecialDateService.class),
-                mock(TimeSeriesService.class),
                 mock(GraphService.class),
                 mock(DataProfileService.class), mock(IntimacyService.class),
                 mock(PersonBasicInfoService.class), mock(PersonGroupService.class));