diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java index bbfbcd6..dd852d0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java @@ -108,6 +108,9 @@ public class RegionsCacheHelperImpl extends AbstractRegionCacheHelper implements * @return 展示名称 */ private String getDisplayName(RegionDTO region, int sLevel) { + if (Objects.isNull(region)) { + return StringUtils.EMPTY; + } Integer level = region.getRegionLevel(); if (RegionConst.RL_PROVINCE > sLevel || sLevel > level) { throw BizException.wrap("区域层级无效"); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java index e44bf86..04c38fc 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java @@ -91,4 +91,9 @@ public class DingInfoPullController { public String getToken() { return employeeBatchGetTask.getToken(); } + + @GetMapping("/getAuthToken") + public String getAuthToken() { + return employeeBatchGetTask.getAuthToken(); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java index 7c991d8..017829a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java @@ -477,4 +477,9 @@ public class EmployeeBatchGetTask { GenericResult accessToken = zwddClient.getAccessToken(); return accessToken.getData(); } + + public String getAuthToken() { + GenericResult accessToken = zwddAuthClient.getAccessToken(); + return accessToken.getData(); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java index 488d3eb..7f5f74a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java @@ -274,7 +274,7 @@ public class ProjectFileManage { // 把条件值给放入工作流 defaultDeclaredProjectManage.buildCondition(params, project); // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 - Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, project); + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMapUserOrgCode(employeeCode, project); String instanceId = processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); log.info("申请借阅申报成功 【{}】", instanceId); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java index 142e3f5..f0a83c9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java @@ -219,6 +219,79 @@ public class DefaultDeclaredProjectManage { return orgMap; } + public Map buildOrgModelMapUserOrgCode(String employeeCode,Project project) { + Map orgMap = new HashMap<>(); + + // 查出所有的单位流程配置 + List orgModelsList = orgProcdefService.list(); + + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); + if(Objects.isNull(userFullInfo)){ + log.warn("取不到员工 返回空map"); + return Collections.emptyMap(); + } + + String startOrgCode = project.getBuildOrgCode(); + String startOrgName = project.getBuildOrgName(); + String startOrgParentCode; + String startOrgParentName; + // 如果申报时 上级主管单位,由该单位自己审核 + if (CommonEnum.NO.getCode().equals(project.getIsSuperOrg())){ + startOrgParentCode = startOrgCode; + startOrgParentName = startOrgName; + }else { + startOrgParentCode = project.getSuperOrgCode(); + startOrgParentName = project.getSuperOrg(); + } + //查询 当前发起人及主管单位所在区域的 单位流程配置 + OrgInfoDTO startOrgInfoDto = new OrgInfoDTO(); + startOrgInfoDto.setOrganizationCode(startOrgCode); + startOrgInfoDto.setOrganizationName(startOrgName); + + 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); + 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(); + orgInfoDTO.setOrgModelMap(orgModelsList.stream() + .collect(Collectors.toMap(WflowOrgModels::getProcessDefId, v -> v))); + orgMap.put(OrgTypeEnum.TARGET_LABEL.name(),orgInfoDTO); + + //如果有上级条线主管单位 并且 不是市本级 + if(!RegionConst.RC_LS.equals(project.getAreaCode()) && + CommonEnum.YES.getCode().equals(project.getIsHigherSuperOrg())){ + OrgInfoDTO parentLineOrgInfoDto = new OrgInfoDTO(); + parentLineOrgInfoDto.setOrganizationCode(project.getHigherSuperOrgCode()); + parentLineOrgInfoDto.setOrganizationName(project.getHigherSuperOrg()); + parentLineOrgInfoDto.setOrgModelMap(orgModelsList.stream() + .filter(v -> v.getOrgCode().equals(project.getHigherSuperOrgCode()) + && 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_LINE_MANAGEMENT.name(),parentLineOrgInfoDto); + } + return orgMap; + } + //根据提交者的单位 public DeclaredProjectStatisticsPO declaredProjectOrgStatistics(Integer year, UserFullInfoDTO user){ //查此人建设单位的项目