feat(mcp): 新增清机记录查询工具 hardware.cleanlog.list.query

对齐老系统 /hardwareCleanLog/listByPage,修正 5 处老接口坑(设计文档
doc/hardware-cleanlog-mcp-design.md §5):agentId 传了仍叠加行级 ACL、
富化/图片按页批量消除 N+1、时间过滤明确落 modify_time、status=1 硬过滤
口径保持、type!=0 时 beforeCleanPics 恒空保持。

- 实体/Mapper 从 publicbeanandmap 逐字段复制(25+13 列全核对)
- PermissionService 新增 applyHardwareCleanLogRowFilter(镜像
  applyHardwareRowFilter 同一 getByIsAgent 变体)
- 分页 selectCount+LIMIT 物理分页,rows 上限 100 截断+notice
- 图片 type=0 行内 picurl,type!=0 按页 IN 批量查 hardware_clean_pic
  按 order_no 拼 OSS URL
- 入参校验抛 ToolCallException(INVALID_ARGUMENT)
- seed-dev.sql 补 hardware/ops-query scope 绑定;reference 文档登记 #45

测试:新增 6 个单测,全量 482 tests 全绿
This commit is contained in:
my_local_kimi_dev2
2026-11-04 18:04:02 +08:00
parent fecbb2d95a
commit 4e27f8137d
11 changed files with 961 additions and 3 deletions
+1
View File
@@ -99,6 +99,7 @@ xiaoqu-agent-service/
| `battery.fault.list.query` | hardware | read | 电池故障分页查询。按站点/物业/代理商/SN/设备类型/故障类型/恢复状态/故障日期筛选;沿用设备行级权限,按故障时间和 ID 倒序。详细设计见 doc/battery-fault-mcp-tool-design.md |
| `hardware.electricity.message.list.query` | hardware | read | 设备电量/信号/温度等消息记录分页查询(ES electricitymessage_yyyyMM 月索引,只走本地集群,无权限过滤,对齐老 /batteryAnalyse/batteryAnalyseList)。入参 snCode(必填)/startTime/endTime(必填且须同一天,跨天拒绝)/messageType(0-5,不传=全部类型)/page/rows(默认 1/500,上限 1000);出参 snCode/index/total/page/rows/records(createTime/messageType/messageTypeText/value),createTime ASC。详细设计见 doc/electricity-message-mcp-tool-design.md |
| `agent.user.list.query` | agent | read | 代理角色用户分页查询(m0 user 表,强制 enterprise_type=1 + soft_delete=0,对齐老 /user/listByPage 代理用户子集)。入参 agentId/name/mobile/no/authorityId/deptId/workStatus/page/rows;出参含 agentName/authorityName/deptList(dept_user 岗位明细)/districtName,mobile 原样不脱敏,不含 idcard/password/openid 与位置字段。行权限:总部看全部,代理商按 visibleAgentIds(自己+直属下级+代管)收缩,agentId 越权拒绝;只绑 prod scope 1。详细设计见 doc/agent-user-list-mcp-tool-design.md |
| `hardware.cleanlog.list.query` | hardware | read | 清机记录分页查询(m0 hardware_clean_log + hardware_clean_pic,对齐老 /hardwareCleanLog/listByPage)。入参 districtId/propertyId/agentId/userId/snCode(模糊)/type/userRoleType/startTime/endTime(按 modify_time)/minCleanRfidCount/maxCleanRfidCount/page/rows;硬过滤 soft_delete=0 且 status=1,固定 id DESC;传 agentId 仍叠加行级 ACL(修老接口绕过 bug);名称 Redis multiGet + user 按页批量富化(修 N+1);type=0 用行内图片,type≠0 按页批量查图片表拼 OSS URL。详细设计见 doc/hardware-cleanlog-mcp-design.md |
分页统一规范:page 从 1 开始,rows 默认 20、上限 100,超出截断为 100 并在返回 `notice` 字段提示。