From fd7ec29374f8555f6ad11a98c84864a2e7b669ab Mon Sep 17 00:00:00 2001 From: xiaoqu Date: Thu, 3 Sep 2026 13:47:01 +0800 Subject: [PATCH] =?UTF-8?q?property.list.query=20=E7=A7=BB=E9=99=A4=20ente?= =?UTF-8?q?rprise=5Ftype=3D2=20=E7=89=A9=E4=B8=9A=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E9=99=90=E5=88=B6=EF=BC=9A=E7=89=A9=E4=B8=9A=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=B8=8D=E6=9F=A5=E6=AD=A4=E5=88=97=E8=A1=A8=EF=BC=8C=E4=B8=8E?= =?UTF-8?q?=E8=80=81=20/property/listByPage=20=E8=AF=AD=E4=B9=89=E4=B8=80?= =?UTF-8?q?=E8=87=B4=EF=BC=88PermissionService=20=E4=BF=9D=E7=95=99=20isPr?= =?UTF-8?q?opertyUser=20=E9=80=9A=E7=94=A8=E6=96=B9=E6=B3=95=EF=BC=89?= =?UTF-8?q?=EF=BC=9B=E5=90=8C=E6=AD=A5=E8=AE=BE=E8=AE=A1=E6=96=87=E6=A1=A3?= =?UTF-8?q?=20=C2=A79.1=20=E4=B8=8E=20README=EF=BC=8C=E5=9B=9E=E5=BD=92=20?= =?UTF-8?q?total=20141/73=20=E4=B8=8D=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xiaoqu-agent-service/README.md | 4 ++-- .../java/me/iiv/agent/mcp/tool/PropertyTools.java | 2 +- .../me/iiv/agent/permission/PermissionService.java | 14 ++++++++------ xiaoqu-franchisee/doc/agent-mcp-service-design.md | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/xiaoqu-agent-service/README.md b/xiaoqu-agent-service/README.md index 2db5d26..3c3de6d 100644 --- a/xiaoqu-agent-service/README.md +++ b/xiaoqu-agent-service/README.md @@ -62,7 +62,7 @@ xiaoqu-agent-service/ | `isAgentAuthority(authorityId)` | `AuthorityServiceImpl.checkAuthorityIsagent` | 权限组 isagent=1 → 代理商视角 | | `visibleAgentIds(user)` | `getByIsAgent` 主重载 | isagent!=1 返回 null(不过滤);否则 自己 + 直属下级(supervisor_id 一层)+ m2 warehouse_agent_auth 代管 manager_agent_id | | `isSalesNonLeader(user)` | saleFlag 逻辑(:382-427) | Redis db5 `Dictionary` hash 的 authDeptId 命中 ",deptId," 且 authDeptPostId 不含 "postId,";字典缺失按不限制处理并告警 | -| `isPropertyUser(user)` | enterprise_type=2 规则 | 物业用户(后续 property 查询再限 property_id=自己) | +| `isPropertyUser(user)` | enterprise_type=2 规则(§3.3 通用规则,保留备用) | 物业用户;**property.list.query 不使用本规则**(物业用户不查此列表,与老 /property/listByPage 一致,2026-09-03 决策) | `agent.list.query` 的行权限照搬老系统 `AgentController.listByPage`:isagent=1 → `supervisor_id = 用户agentId`(只查直属下级);isagent=0 → 不过滤;入参传 `id` → 精确查询(可查到自身,不加 supervisor 限制)。 @@ -73,7 +73,7 @@ xiaoqu-agent-service/ | `sys.ping` | system | read | 服务自检:服务名、版本、当前时间、Redis PING | | `agent.count` | system | read | 查 m0 库 `agent` 表 `soft_delete=0` 总数 | | `agent.list.query` | customer | read | 代理商分页查询。入参 id/name/level/channelNo/province/city/serialnumber/page/rows;出参 id/name/level/channelNo/serialnumber/supervisorName/province/city/countyseat/contact/phone/agencyarea/memo/createTime。行权限:isagent=1 只查直属下级,id 精确查可看自身。supervisorName 批量 IN 富化 | -| `property.list.query` | customer | read | 物业(客户)分页查询(m0 properyt 表)。入参 name/agentId/serialnumber/province/city/contact/phone/page/rows;出参 id/name/serialnumber/agentName/createName/province/city/countyseat/address/contact/phone/createTime。行权限走 PermissionService 完整版 getByIsAgent 语义。agentName/createName 批量 IN 富化 | +| `property.list.query` | customer | read | 物业(客户)分页查询(m0 properyt 表)。入参 name/agentId/serialnumber/province/city/contact/phone/page/rows;出参 id/name/serialnumber/agentName/createName/province/city/countyseat/address/contact/phone/createTime。行权限走 PermissionService 完整版 getByIsAgent 语义(不含 enterprise_type=2 限制,与老 /property/listByPage 一致)。agentName/createName 批量 IN 富化 | 分页统一规范:page 从 1 开始,rows 默认 20、上限 100,超出截断为 100 并在返回 `notice` 字段提示。 diff --git a/xiaoqu-agent-service/src/main/java/me/iiv/agent/mcp/tool/PropertyTools.java b/xiaoqu-agent-service/src/main/java/me/iiv/agent/mcp/tool/PropertyTools.java index 8f7b0de..24a22ba 100644 --- a/xiaoqu-agent-service/src/main/java/me/iiv/agent/mcp/tool/PropertyTools.java +++ b/xiaoqu-agent-service/src/main/java/me/iiv/agent/mcp/tool/PropertyTools.java @@ -51,7 +51,7 @@ public class PropertyTools implements ToolObject { @Tool(name = "property.list.query", description = "查询物业(客户)列表(分页),数据来源 m0 库 properyt 表。" + "行级权限:代理商身份的用户(权限组 isagent=1)只能看到 自己+直属下级代理+被授权代管代理 名下的物业," + "以及被授权代管的物业(agent_manage_district_auth);总部身份(isagent=0)可看全部;" - + "物业账号(enterprise_type=2)只能看自己物业;销售部门非负责人只能看自己创建的物业。" + + "销售部门非负责人只能看自己创建的物业。" + "分页:page 从 1 开始,rows 默认 20、上限 100,超出自动截断为 100 并在返回的 notice 字段提示。" + "返回 total(符合条件的总数)、records(本页记录)。") public Map propertyListQuery( diff --git a/xiaoqu-agent-service/src/main/java/me/iiv/agent/permission/PermissionService.java b/xiaoqu-agent-service/src/main/java/me/iiv/agent/permission/PermissionService.java index 08210ad..2709223 100644 --- a/xiaoqu-agent-service/src/main/java/me/iiv/agent/permission/PermissionService.java +++ b/xiaoqu-agent-service/src/main/java/me/iiv/agent/permission/PermissionService.java @@ -106,7 +106,12 @@ public class PermissionService { && !authDeptPostId.toString().contains(user.getPostId() + ","); } - /** 物业用户(enterprise_type=2):老系统语义为再限 property_id=自己 */ + /** + * 物业用户(enterprise_type=2):设计文档 §3.3 通用规则为再限 property_id=自己。 + * 注意:property.list.query 不使用本规则——物业用户不查此列表, + * 与老系统 /property/listByPage(PropertyController.java:95)语义保持一致。 + * 本方法保留供其他需要该通用规则的场景使用。 + */ public boolean isPropertyUser(User user) { return user.getEnterpriseType() != null && user.getEnterpriseType() == 2; } @@ -134,12 +139,12 @@ public class PermissionService { *
  • isagent=1:agent_id IN (自己+下级+warehouse_agent_auth 代管), * 若存在代管物业则 OR id IN (agent_manage_district_auth 代管物业 id 集合);
  • *
  • isagent!=1(总部):不加 agent/id 过滤;
  • - *
  • enterprise_type=2(物业用户):再 AND id = 用户 propertyId - * (注:老 PropertyController 未挂此限制,来自设计文档 §3.3 通用规则);
  • *
  • 销售部门非负责人:再 AND create_id = 自己 * (注:老代码 saleFlag 分支是 id IN (自建 ∪ 代管 agent 的物业), * 此处按设计文档 §3.3"只看 create_id=自己"收窄)。
  • * + * 不含 enterprise_type=2(物业用户)限制:物业用户不查此列表,与老接口语义一致 + * (2026-09-03 用户决策;§3.3 通用规则保留于 {@link #isPropertyUser})。 */ public void applyPropertyRowFilter(LambdaQueryWrapper wrapper, User user) { List agentIds = visibleAgentIds(user); @@ -151,9 +156,6 @@ public class PermissionService { wrapper.in(Properyt::getAgentId, agentIds); } } - if (isPropertyUser(user)) { - wrapper.eq(Properyt::getId, user.getPropertyId()); - } if (isSalesNonLeader(user)) { wrapper.eq(Properyt::getCreateId, user.getId()); } diff --git a/xiaoqu-franchisee/doc/agent-mcp-service-design.md b/xiaoqu-franchisee/doc/agent-mcp-service-design.md index bb90806..04a26de 100644 --- a/xiaoqu-franchisee/doc/agent-mcp-service-design.md +++ b/xiaoqu-franchisee/doc/agent-mcp-service-design.md @@ -210,7 +210,7 @@ xiaoqu-agent-service/ **`property.list.query`**(分类 customer,读) -- 语义照搬:完整版 `getByIsAgent`(下级代理 + warehouse_agent_auth 代管 + agent_manage_district_auth 代管物业 + 销售非负责人限 create_id)。 +- 语义照搬:完整版 `getByIsAgent`(下级代理 + warehouse_agent_auth 代管 + agent_manage_district_auth 代管物业 + 销售非负责人限 create_id)。**不含** enterprise_type=2(物业用户限自己物业)限制——物业用户不查此列表,与老接口 `/property/listByPage`(PropertyController.java:95)语义一致(2026-09-03 决策;§3.3 通用规则表保留该条,仅此处不适用)。 - 入参:`name`(模糊)、`agentId`、`serialnumber`、`province`、`city`、`contact`、`phone`、`page`、`rows`。 - 出参:id、name、serialnumber、agentName、createName(销售)、province/city/countyseat、address、contact、phone、createTime。 - 已裁剪:开票信息、银行账户。