|
|
|
@ -97,6 +97,10 @@ public class InspectionRequestServiceImpl extends ServiceImpl<InspectionRequestH |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageUtils myPage(InspectionRequestHeader data){ |
|
|
|
// rqrq - 只在内部申请页覆盖精确账号;其他共用页面保留原查询条件。 |
|
|
|
if (Boolean.TRUE.equals(data.getCurrentPlannerOnly())) { |
|
|
|
data.setPlannerAccount(resolveCurrentPlannerAccount(data.getCurrentPlannerOnly())); |
|
|
|
} |
|
|
|
// 强制使用当前登录工厂,避免前端漏传 site 导致跨工厂数据 |
|
|
|
SysUserEntity currentUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); |
|
|
|
if (currentUser == null || !StringUtils.hasText(currentUser.getSite())) { |
|
|
|
@ -125,6 +129,8 @@ public class InspectionRequestServiceImpl extends ServiceImpl<InspectionRequestH |
|
|
|
if (data == null || !StringUtils.hasText(data.getSite())) { |
|
|
|
throw new RuntimeException("请前端传site"); |
|
|
|
} |
|
|
|
// rqrq - 服务端限定本人订单;供应商模式不增加 Planner 条件。 |
|
|
|
data.setPlannerAccount(resolveCurrentPlannerAccount(data.getCurrentPlannerOnly())); |
|
|
|
IPage<InspectionRequestItemVO> page = |
|
|
|
baseMapper.queryPoPage(new Page<>(data.getPage(), data.getLimit()), data); |
|
|
|
return new PageUtils(page); |
|
|
|
@ -136,6 +142,8 @@ public class InspectionRequestServiceImpl extends ServiceImpl<InspectionRequestH |
|
|
|
if (data == null || !StringUtils.hasText(data.getSite())) { |
|
|
|
throw new RuntimeException("请前端传site"); |
|
|
|
} |
|
|
|
// rqrq - 补选 PO 与初次选择采用相同的本人范围。 |
|
|
|
data.setPlannerAccount(resolveCurrentPlannerAccount(data.getCurrentPlannerOnly())); |
|
|
|
IPage<InspectionRequestItemVO> page = |
|
|
|
baseMapper.queryPoPageExclude(new Page<>(data.getPage(), data.getLimit()), data); |
|
|
|
return new PageUtils(page); |
|
|
|
@ -147,6 +155,8 @@ public class InspectionRequestServiceImpl extends ServiceImpl<InspectionRequestH |
|
|
|
if (data == null || !StringUtils.hasText(data.getSite())) { |
|
|
|
throw new RuntimeException("请前端传site"); |
|
|
|
} |
|
|
|
// rqrq - 供应商归属按供应商主档 Planner 的账号精确筛选。 |
|
|
|
data.setPlannerAccount(resolveCurrentPlannerAccount(data.getCurrentPlannerOnly())); |
|
|
|
IPage<InspectionRequestItemVO> page = |
|
|
|
baseMapper.queryPoSupplierPage(new Page<>(data.getPage(), data.getLimit()), data); |
|
|
|
return new PageUtils(page); |
|
|
|
@ -158,11 +168,34 @@ public class InspectionRequestServiceImpl extends ServiceImpl<InspectionRequestH |
|
|
|
if (data == null || !StringUtils.hasText(data.getSite())) { |
|
|
|
throw new RuntimeException("请前端传site"); |
|
|
|
} |
|
|
|
// rqrq - 从订单选择供应商按订单头 Planner 的账号精确筛选。 |
|
|
|
data.setPlannerAccount(resolveCurrentPlannerAccount(data.getCurrentPlannerOnly())); |
|
|
|
IPage<InspectionRequestItemVO> 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) { |
|
|
|
|