Commit 0f85eac1 by 王志超

feat: 变更行动工单列表

parent 4d2346a4
......@@ -341,37 +341,18 @@ public class ChangeSubFlowBiz {
log.info("[querySubFlowList] page:{}, pageSize:{}, queryReq:{}", page, pageSize, JSON.toJSONString(queryReq));
// 根据主单条件(flowId, itemId, supplier, onlyMyFollowed)查询主单,获取 changeRecordIds
List<Long> changeRecordIds = null;
if (queryReq.getFlowId() != null || StringUtils.isNotBlank(queryReq.getItemId())
|| StringUtils.isNotBlank(queryReq.getSupplier()) || queryReq.getOnlyMyFollowed()) {
// 构建主单查询条件
ChangeFlowListQueryReq mainQueryReq = new ChangeFlowListQueryReq();
mainQueryReq.setFlowId(queryReq.getFlowId());
mainQueryReq.setItemId(queryReq.getItemId());
mainQueryReq.setSupplier(queryReq.getSupplier());
mainQueryReq.setOnlyMyFollowed(queryReq.getOnlyMyFollowed());
String currentUser = RequestLocalBean.getUid();
// 数据可见范围:变更负责人=当前用户的变更工单所关联的全部变更行动工单
if (queryReq.getOnlyMyFollowed()) {
if (StringUtils.isNotBlank(currentUser)) {
mainQueryReq.setChangeCommander(currentUser);
}
}
// 查询主单(不分页,只获取ID)
List<ChangeRecord> changeRecords = changeRecordMapper.selectByCondition(mainQueryReq);
List<Long> flowRecordIds = fileterFlowRecordIds(queryReq);
if (CollectionUtils.isEmpty(flowRecordIds)) {
// 如果主单查询结果为空,直接返回
if (CollectionUtils.isEmpty(changeRecords)) {
PageVO pageVO = buildPageVo(0L, pageSize, page);
ChangeSubFlowListVO result = new ChangeSubFlowListVO();
result.setPageVo(pageVO);
result.setChangeSubFlowList(new ArrayList<>());
return result;
}
changeRecordIds = changeRecords.stream().map(ChangeRecord::getId).distinct().collect(Collectors.toList());
queryReq.setChangeRecordIds(flowRecordIds);
}
// 根据行动项条件(changeExecUser, changeExecDepartment)查询执行项,获取 subFlowRecordId,然后查询子单获取 subFlowId 列表
......@@ -566,6 +547,32 @@ public class ChangeSubFlowBiz {
return result;
}
private List<Long> fileterFlowRecordIds(ChangeSubFlowListQueryReq queryReq) {
// 构建主单查询条件
ChangeFlowListQueryReq mainQueryReq = new ChangeFlowListQueryReq();
mainQueryReq.setFlowId(queryReq.getFlowId());
mainQueryReq.setItemId(queryReq.getItemId());
mainQueryReq.setSupplier(queryReq.getSupplier());
mainQueryReq.setOnlyMyFollowed(queryReq.getOnlyMyFollowed());
String currentUser = RequestLocalBean.getUid();
// 数据可见范围:变更负责人=当前用户的变更工单所关联的全部变更行动工单
if (queryReq.getOnlyMyFollowed()) {
if (StringUtils.isNotBlank(currentUser)) {
mainQueryReq.setChangeCommander(currentUser);
}
}
// 查询主单(不分页,只获取ID)
List<ChangeRecord> changeRecords = changeRecordMapper.selectByCondition(mainQueryReq);
if (CollectionUtils.isEmpty(changeRecords)) {
return new ArrayList<>();
}
return changeRecords.stream().map(ChangeRecord::getId).distinct().collect(Collectors.toList());
}
/**
* 构建分页信息
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment