Merge branch 'feature/REQ-2090' into 1.3.1-SNAPSHOT

This commit is contained in:
wangli 2024-04-01 20:25:27 +08:00
commit 5cd79a8197
2 changed files with 21 additions and 16 deletions

View File

@ -5,6 +5,7 @@ import cn.axzo.workflow.common.model.dto.CooperationOrgDTO.OrgScope;
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskDelegateAssigner;
import cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.bpmn.model.UserTask;
@ -39,7 +40,7 @@ public class PreTaskUserProcessor implements ApproverScopeProcessor {
// 获取上一级节点
List<BpmnTaskDelegateAssigner> assigners = (List<BpmnTaskDelegateAssigner>) execution
.getVariableLocal(INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT + preActivityId);
List<OrgScope> entOrg = assigners.stream()
List<OrgScope> entOrg = CollectionUtils.emptyIfNull(assigners).stream()
.map(a -> {
CooperationOrgDTO.OrgScope orgScope = new CooperationOrgDTO.OrgScope()
.setWorkspaceId(Long.valueOf(a.getTenantId()));

View File

@ -3,13 +3,11 @@ package cn.axzo.workflow.core.deletage.approverscope;
import cn.axzo.workflow.common.enums.WorkspaceType;
import cn.axzo.workflow.common.model.dto.CooperationOrgDTO;
import cn.axzo.workflow.common.model.dto.CooperationOrgDTO.OrgScope;
import cn.hutool.core.collection.CollUtil;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.engine.delegate.DelegateExecution;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@ -18,6 +16,7 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.BIZ_ORG_RELATION;
/**
* "审批范围"选择"所在项目部"
*
* @author syl
* @date 2023/11/21
*/
@ -27,21 +26,26 @@ public class ProjectWorkspaceProcessor implements ApproverScopeProcessor {
@Override
public ApproverScopeDTO build(FlowElement flowElement, DelegateExecution execution) {
// 发起项目部
CooperationOrgDTO orgDTO =(CooperationOrgDTO) execution.getVariables().get(BIZ_ORG_RELATION);
if (Objects.isNull(orgDTO) || CollectionUtils.isEmpty(orgDTO.getOrgScopes())) {
return ApproverScopeDTO.builder().build();
CooperationOrgDTO orgDTO = (CooperationOrgDTO) execution.getVariables().get(BIZ_ORG_RELATION);
ApproverScopeDTO build = ApproverScopeDTO.builder().build();
if (Objects.isNull(orgDTO)) {
return build;
}
if (!CollectionUtils.isEmpty(orgDTO.getOrgScopes())) {
List<OrgScope> orgScopes = orgDTO.getOrgScopes().stream()
.filter(o -> WorkspaceType.PROJECT == WorkspaceType.getType(o.getWorkspaceType()))
.collect(Collectors.toList());
build.setOrgScopes(orgScopes);
}
List<OrgScope> orgScopes = orgDTO.getOrgScopes().stream()
.filter(o -> WorkspaceType.PROJECT == WorkspaceType.getType(o.getWorkspaceType()))
.collect(Collectors.toList());
List<OrgScope> workerTeamScopes = CollUtil.defaultIfEmpty(orgDTO.getWorkerTeamScopes(),
Collections.emptyList())
.stream()
.filter(o -> WorkspaceType.PROJECT == WorkspaceType.getType(o.getWorkspaceType()))
.collect(Collectors.toList());
return ApproverScopeDTO.builder().orgScopes(orgScopes)
.workerTeamScopes(workerTeamScopes).build();
if (!CollectionUtils.isEmpty(orgDTO.getWorkerTeamScopes())) {
List<OrgScope> workerTeamScopes = orgDTO.getWorkerTeamScopes()
.stream()
.filter(o -> WorkspaceType.PROJECT == WorkspaceType.getType(o.getWorkspaceType()))
.collect(Collectors.toList());
build.setWorkerTeamScopes(workerTeamScopes);
}
return build;
}
}