Browse Source

发起流程Map信息修改

master
CMM 1 year ago
parent
commit
d9d4d31412
1 changed files with 39 additions and 23 deletions
  1. +39
    -23
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java

+ 39
- 23
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java View File

@@ -70,6 +70,10 @@ public class DefaultDeclaredProjectManage {

public Map<String, OrgInfoDTO> getOrgModelInfo(Long userId, WflowModels model) {
Map<String, OrgInfoDTO> orgMap = new HashMap<>();

// 查出所有的单位流程配置
List<WflowOrgModels> orgModelsList = orgProcdefService.list();

UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId);
DingOrganization startOrg = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getOrganizationCode, userFullInfo.getOrganizationCode()));
@@ -78,36 +82,48 @@ public class DefaultDeclaredProjectManage {
String startOrgParentCode = startOrg.getParentCode();
String startOrgParentName = startOrg.getParentName();
//查询 当前发起人及主管单位所在区域的 单位流程配置
OrgInfoDTO startOrgInfoDto = getOrgInfoDTO(model,startOrgCode, startOrgName);
OrgInfoDTO startOrgParentInfoDto = getOrgInfoDTO(model, startOrgParentCode, startOrgParentName);
orgMap.put(OrgTypeEnum.TARGET_OWNER.name(),startOrgInfoDto);
orgMap.put(OrgTypeEnum.TARGET_MANAGEMENT.name(),startOrgParentInfoDto);
// 如果是指定单位,直接根据流程定义ID放入map
Map<String, WflowOrgModels> orgModelMap = orgProcdefService.list().stream()
.filter(v -> v.getProcessDefId().equals(model.getProcessDefId()))
.collect(Collectors.toMap(WflowOrgModels::getProcessDefId, v -> v));
OrgInfoDTO orgInfoDTO = new OrgInfoDTO();
orgInfoDTO.setOrgModelMap(orgModelMap);
orgMap.put(model.getProcessDefId(),orgInfoDTO);
return orgMap;
}
OrgInfoDTO startOrgInfoDto = new OrgInfoDTO();
startOrgInfoDto.setOrganizationCode(startOrgCode);
startOrgInfoDto.setOrganizationName(startOrgName);
Map<String, WflowOrgModels> startOrgModelsMap = orgModelsList.stream()
.filter(v -> v.getOrgCode().equals(startOrgCode))
.filter(v -> StringUtils.isNotEmpty(model.getProcessDefId()) &&
v.getProcessDefId().equals(model.getProcessDefId()))
.filter(v -> Boolean.FALSE.equals(v.getIsDelete())).collect(Collectors.toMap(m -> {
if (ProcessDefTypeEnum.SEAL.name().equals(m.getType()) ||
ProcessDefTypeEnum.DEFAULT.name().equals(m.getType())) {
return m.getType();
}
return m.getProcessDefId();
}, v -> v));
startOrgInfoDto.setOrgModelMap(startOrgModelsMap);

private OrgInfoDTO getOrgInfoDTO(WflowModels model, String orgCode, String orgName) {
Map<String, WflowOrgModels> startOrgModelsMap = orgProcdefService.list(Wrappers.lambdaQuery(WflowOrgModels.class)
.eq(WflowOrgModels::getOrgCode, orgCode)
.eq(StringUtils.isNotEmpty(model.getProcessDefId()), WflowOrgModels::getProcessDefId, model.getProcessDefId())
.eq(WflowOrgModels::getIsDelete, Boolean.FALSE)).stream()
.collect(Collectors.toMap(m -> {
OrgInfoDTO parentOrgInfoDto = new OrgInfoDTO();
parentOrgInfoDto.setOrganizationCode(startOrgParentCode);
parentOrgInfoDto.setOrganizationName(startOrgParentName);
Map<String, WflowOrgModels> parentOrgModelMap = orgModelsList.stream()
.filter(v -> v.getOrgCode().equals(startOrgParentCode))
.filter(v -> StringUtils.isNotEmpty(model.getProcessDefId()) &&
v.getProcessDefId().equals(model.getProcessDefId()))
.filter(v -> Boolean.FALSE.equals(v.getIsDelete())).collect(Collectors.toMap(m -> {
if (ProcessDefTypeEnum.SEAL.name().equals(m.getType()) ||
ProcessDefTypeEnum.DEFAULT.name().equals(m.getType())) {
return m.getType();
}
return m.getProcessDefId();
}, v -> v));
parentOrgInfoDto.setOrgModelMap(parentOrgModelMap);

orgMap.put(OrgTypeEnum.TARGET_OWNER.name(),startOrgInfoDto);
orgMap.put(OrgTypeEnum.TARGET_MANAGEMENT.name(),parentOrgInfoDto);

// 如果是指定单位,直接根据流程定义ID放入map
OrgInfoDTO orgInfoDTO = new OrgInfoDTO();
orgInfoDTO.setOrganizationCode(orgCode);
orgInfoDTO.setOrganizationName(orgName);
orgInfoDTO.setOrgModelMap(startOrgModelsMap);
return orgInfoDTO;
Map<String, WflowOrgModels> orgModelMap = orgModelsList.stream()
.filter(v -> v.getProcessDefId().equals(model.getProcessDefId()))
.collect(Collectors.toMap(WflowOrgModels::getProcessDefId, v -> v));
orgInfoDTO.setOrgModelMap(orgModelMap);
orgMap.put(model.getProcessDefId(),orgInfoDTO);
return orgMap;
}
}

Loading…
Cancel
Save