Browse Source

优化代码

master
PoffyZhang 1 year ago
parent
commit
038300545d
1 changed files with 15 additions and 28 deletions
  1. +15
    -28
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java

+ 15
- 28
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java View File

@@ -85,44 +85,31 @@ public class DefaultDeclaredProjectManage {
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);

startOrgInfoDto.setOrgModelMap(orgModelsList.stream()
.filter(v -> v.getOrgCode().equals(startOrgCode)
&& Boolean.FALSE.equals(v.getIsDelete())
&& (ProcessDefTypeEnum.SEAL.name().equals(v.getType()) ||
ProcessDefTypeEnum.DEFAULT.name().equals(v.getType())))
.collect(Collectors.toMap(WflowOrgModels::getType, v -> v)));

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);
parentOrgInfoDto.setOrgModelMap(orgModelsList.stream()
.filter(v -> v.getOrgCode().equals(startOrgParentCode)
&& Boolean.FALSE.equals(v.getIsDelete())
&& (ProcessDefTypeEnum.SEAL.name().equals(v.getType()) ||
ProcessDefTypeEnum.DEFAULT.name().equals(v.getType())))
.collect(Collectors.toMap(WflowOrgModels::getType, v -> v)));

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

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


Loading…
Cancel
Save