From b23e959404fa69b72d2e4b2b704bf90600cc91c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=B8=E7=86=9F=E5=90=B4=E5=BD=A6=E7=A5=96?= Date: Mon, 21 Sep 2026 17:08:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AA=8C=E8=B4=A7=E5=8D=95=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/InspectionRequestItemVO.java | 6 ++++ .../entity/InspectionRequestHeader.java | 3 ++ .../impl/InspectionRequestServiceImpl.java | 33 +++++++++++++++++++ .../InspectionRequestHeaderMapper.xml | 16 +++++++++ 4 files changed, 58 insertions(+) diff --git a/src/main/java/com/xujie/modules/inspection/data/InspectionRequestItemVO.java b/src/main/java/com/xujie/modules/inspection/data/InspectionRequestItemVO.java index 11b4e88..e7943a5 100644 --- a/src/main/java/com/xujie/modules/inspection/data/InspectionRequestItemVO.java +++ b/src/main/java/com/xujie/modules/inspection/data/InspectionRequestItemVO.java @@ -106,6 +106,12 @@ public class InspectionRequestItemVO extends QueryPage { */ private String planner; + /** 内部验货申请页的本人 Planner 查询范围开关 - rqrq */ + private Boolean currentPlannerOnly; + + /** 精确筛选账号,由 Service 从登录会话覆盖,不能使用 Planner 显示名称 - rqrq */ + private String plannerAccount; + /** * 供应商可申请验货PO明细数量 */ diff --git a/src/main/java/com/xujie/modules/inspection/entity/InspectionRequestHeader.java b/src/main/java/com/xujie/modules/inspection/entity/InspectionRequestHeader.java index e6ce305..ea27ec8 100644 --- a/src/main/java/com/xujie/modules/inspection/entity/InspectionRequestHeader.java +++ b/src/main/java/com/xujie/modules/inspection/entity/InspectionRequestHeader.java @@ -92,6 +92,9 @@ public class InspectionRequestHeader extends QueryPage { // 以下为前端查询条件扩展字段(非数据库字段) private String supplierName; // 供应商名称 private String plannerAccount; // Planner账号(精确筛选) + /** 内部验货申请页按当前登录账号限定 Planner;供应商及其他页面不启用 - rqrq */ + @TableField(exist = false) + private Boolean currentPlannerOnly; private String requestDateStart; // 申请日期开始 private String requestDateEnd; // 申请日期结束 private String needInspectDateStart; // 建议验货日期开始 diff --git a/src/main/java/com/xujie/modules/inspection/service/impl/InspectionRequestServiceImpl.java b/src/main/java/com/xujie/modules/inspection/service/impl/InspectionRequestServiceImpl.java index bbaf4cd..425ff23 100644 --- a/src/main/java/com/xujie/modules/inspection/service/impl/InspectionRequestServiceImpl.java +++ b/src/main/java/com/xujie/modules/inspection/service/impl/InspectionRequestServiceImpl.java @@ -97,6 +97,10 @@ public class InspectionRequestServiceImpl extends ServiceImpl page = baseMapper.queryPoPage(new Page<>(data.getPage(), data.getLimit()), data); return new PageUtils(page); @@ -136,6 +142,8 @@ public class InspectionRequestServiceImpl extends ServiceImpl page = baseMapper.queryPoPageExclude(new Page<>(data.getPage(), data.getLimit()), data); return new PageUtils(page); @@ -147,6 +155,8 @@ public class InspectionRequestServiceImpl extends ServiceImpl page = baseMapper.queryPoSupplierPage(new Page<>(data.getPage(), data.getLimit()), data); return new PageUtils(page); @@ -158,11 +168,34 @@ public class InspectionRequestServiceImpl extends ServiceImpl page = baseMapper.queryPoSupplierOrderPage(new Page<>(data.getPage(), data.getLimit()), data); return new PageUtils(page); } + /** + * 解析内部验货申请页的本人 Planner 查询范围 - rqrq。 + * 前置条件:调用方已校验业务查询参数;开关仅由内部申请页面启用。 + * 步骤:未启用时返回 null 保持共用查询逻辑;启用时读取登录用户 username。 + * 此方法只构建查询条件,不写库、不开启事务;缺少有效登录账号时拒绝查询, + * 防止空账号导致精确筛选条件被省略。中文显示名及客户端传入账号均不参与授权范围。 + */ + private String resolveCurrentPlannerAccount(Boolean currentPlannerOnly) { + // rqrq - 供应商及其他页面不增加本人 Planner 限制。 + if (!Boolean.TRUE.equals(currentPlannerOnly)) { + return null; + } + Object principal = SecurityUtils.getSubject().getPrincipal(); + // rqrq - 未登录时不能退化为查询所有 Planner 的数据。 + if (!(principal instanceof SysUserEntity) + || !StringUtils.hasText(((SysUserEntity) principal).getUsername())) { + throw new RuntimeException("当前登录账号不能为空"); + } + return ((SysUserEntity) principal).getUsername().trim(); + } + @Transactional(rollbackFor = Exception.class) @Override public void saveRequest(InspectionRequestSaveVO vo) { diff --git a/src/main/resources/mapper/inspection/InspectionRequestHeaderMapper.xml b/src/main/resources/mapper/inspection/InspectionRequestHeaderMapper.xml index daafc33..67af517 100644 --- a/src/main/resources/mapper/inspection/InspectionRequestHeaderMapper.xml +++ b/src/main/resources/mapper/inspection/InspectionRequestHeaderMapper.xml @@ -110,6 +110,10 @@ ON pod.part_no = p.part_no AND pod.site = p.site WHERE pod.site = #{query.site} + + + AND poh.c_planner = #{query.plannerAccount} + AND poh.order_type = 'PO' AND ISNULL(poh.status, '') NOT IN ('Draft','Shipped','Closed','Cancelled','草稿','已发货','已关闭','已取消') AND ( @@ -196,6 +200,10 @@ ON pod.part_no = p.part_no AND pod.site = p.site WHERE pod.site = #{query.site} + + + AND poh.c_planner = #{query.plannerAccount} + AND ISNULL(poh.status, '') NOT IN ('Draft','Shipped','Closed','Cancelled','草稿','已发货','已关闭','已取消') AND ( ISNULL(pod.qty, 0) @@ -289,6 +297,10 @@ ON pod.part_no = p.part_no AND pod.site = p.site WHERE pod.site = #{query.site} + + + AND poh.c_planner = #{query.plannerAccount} + AND poh.order_type = 'PO' AND ISNULL(poh.status, '') NOT IN ('Draft','Shipped','Closed','Cancelled','草稿','已发货','已关闭','已取消') AND ( @@ -347,6 +359,10 @@ ON ss.site = pod.site AND ss.supplier_no = poh.supplier_no WHERE pod.site = #{query.site} + + + AND ss.planner = #{query.plannerAccount} + AND poh.order_type = 'PO' AND ISNULL(poh.status, '') NOT IN ('Draft','Shipped','Closed','Cancelled','草稿','已发货','已关闭','已取消') AND (